MyBB Community Forums

Full Version: Displaying News on your homepage
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
Try this, no guarantees:
PHP Code:
$str = array('a''e''ó''s''l''z''c''n'' ');
$rep = array('a''e''o''s''l''z''c''n''-');
$linksubject str_replace($str$rep$row['subject']);
        
echo(
"<a href=\"{$forumpath}{$linksubject}-t-{$row['tid']}\">{$row['subject']}</a> - 
     Posted: {$date} {$time} by <a href=\"{$forumpath}member.php?action=profile&uid={$row2['uid']}\">{$row2['username']}</a><br />"
);
echo(
"{$message}<br /><br />");
echo(
"Replies (<a href=\"{$forumpath}{$linksubject}-t-{$row['tid']}\">{$row['replies']}</a>)<br /><hr />"); 
unfortunately there is encoding problem. polish chars in anchor is fine but in address are "�l" chars instead of replaced by_str_replace chars.
Are the polish characters not used in the links then?
output looks like this:
Code:
<a href="http://forum.strefacms.pl/modu�y-mdcontact-i-captcha-t-42.html">Moduły MDContact i CAPTCHA</a>
Can you post me an example of what that link should look like. (The same link).
Quote:<a href="http://forum.strefacms.pl/moduly-mdcontact-i-captcha-t-42.html">Moduły MDContact i CAPTCHA</a>
it should look like this (difference is bold)
That's because the Polish characters you provided for me didn't include ł.

Could you try updating:
PHP Code:
$str = array('a''e''ó''s''l''z''c''n'' '); 
With a full set of polish characters you need to change. Also make sure it corresponds correctly with $rep.
Code:
$str = array('ą', 'ę', 'ó', 'ś', 'ł', 'ż', 'ć', 'ń', ' ');
$rep = array('a', 'e', 'o', 's', 'l', 'z', 'c', 'n', '-');
$linksubject = str_replace($str, $rep, strtolower($row['subject']));
Can you remove that strtolower and see if it works correctly.
Ok, that should work. Does it?

I should also point out that you should probably check the SEO mod to find all characters that it replaces with an '-' or a '' because if you use them in your titles they could break your links from the news. I imagine they would be things like ',' '.' '!' etc.

EDIT:
You could also try running the strtolower after the str_replace, it may not be able to handle those characters.
PHP Code:
$linksubject str_replace($str$rep$row['subject']);
$linksubject strtolower($linksubject); 
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
Reference URL's