We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Bug in post's and | Forum

David
David Oct 3 '14

In some cases there is such insertion into post's <title> and <meta name="description"...


<title>SOME TEXT


MORE TEXT.</title>


and


<meta name="description" content="SOME TEXT


MORE TEXT" />


as you can see that there are a \n\n in texts between lines.


In DB we have:

'SOME TEXT...\n\nMORE TEXT.',


Why this appears and how to fix it in script to remove any cases insertion into DB?

Please help to fix this SEO bug.

ross Team
ross Oct 6 '14
I'm sorry can you please provide screenshots of such post and DB example of such post, so we could assist you better?
David
David Oct 6 '14

Just look at this link:

please see in:

view-source:www.bigpro.pics/photo/view/128/latest


You will see that:


<title>Мечты

сбываются... | Фотография на сайте Big Professional Pictures</title>


and:


<meta name="description" content="Мечты 

сбываются... - фотография с тегом " />


and thus in DB we have:


'Мечты \n сбываются...'


i.e - \n - in text!




The Forum post is edited by David Oct 6 '14
ross Team
ross Oct 6 '14
I took a look at your website, you have removed Oxwall attribution link, you're not eligible to do that. 


Restore the link first, otherwise we won't assist you. 

David
David Oct 7 '14
Oxwall attribution link restored, sorry.

Let's start to correct script errors?

The Forum post is edited by David Oct 7 '14
ross Team
ross Oct 7 '14
David, we cannot reproduce that on our test websites or demo. 


What software version and photo plugin version do you currently have?

David
David Oct 8 '14
No, you'll can reproduce this bug if you insert Enter (by pushing Enter) in photo description between text. And thus you'll achieve an \n symbol in DB and visual indent like I wrote:


<meta name="description" content="THIS (here is break, not in one line) 

TEXT IS BROKEN " />


and thus in DB we have:


'THIS \n TEXT IS BROKEN'


i.e - \n - in text!


Just push Enter (like many users do in their photo descr.) between words.

ross Team
ross Oct 8 '14
/ow_core/document.php
find public function setTitle( $title )

add this line to the function:
$title = str_replace(PHP_EOL, "", $title);

now the function should look like this:

 public function setTitle( $title )
    {
        $title = str_replace(PHP_EOL, "", $title);
        $this->throwEvent("core.set_document_title", array("str" => $title));
        $this->title = $title;
    }
David
David Oct 9 '14
Will this fix be included in the next Oxwall release by default?
ross Team
ross Oct 9 '14
Of course. 
David
David Oct 10 '14
Please do not forget about this part to change to default state in script:


public function setDescription( $description ) 

$description = str_replace(PHP_EOL, " ", $description); 

$description = str_replace("  ", " ", $description); 

$this->throwEvent("core.set_document_description", array("str" => $description)); 

$this->description = $description; 

}


P.S. second $description = str_replace is for remove any double spaces between words in: <meta name="description">

The Forum post is edited by David Oct 10 '14