Seo vriendelijke urls

Gestart doorDaviddavid5 reacties25 weergaven

6 berichten · pagina 1 van 1

Daviddavid

Lid · Topicstarter

Berichten
449
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hallo,

Ik wil graag Seo vriendelijke urls in mijn forum.
Hoe kan ik het beste rare tekens filteren enzo?

A.v.b. David
0
Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik gebruik deze functie voor gedichtjestijd.nl:

[COLOR= #0000BB]<?php[/COLOR]

[URL="http://www.php.net/class"]class[/URL] core [COLOR= #007700]{[/COLOR]
    
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] parseUrl[COLOR= #007700]([/COLOR][COLOR= #0000BB]$input[/COLOR][COLOR= #007700])
    {[/COLOR]
        
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/stripslashes"]stripslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000] [/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]-[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]?[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]![/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]@[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]#[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]$[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]%[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]&[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000],[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        
        [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700];
        
    }
    
}[/COLOR]

[COLOR= #0000BB]$core[/COLOR] [COLOR= #007700]= new[/COLOR] core[COLOR= #007700];[/COLOR]

?>


Je kan hem zo aanroepen:

[COLOR= #0000BB]<?php[/COLOR]

[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$core[/COLOR][COLOR= #007700]->[/COLOR]parseUrl[COLOR= #007700]([/COLOR][COLOR= #DD0000]seo@onvriendelijke"url[/COLOR][COLOR= #007700]);[/COLOR]

?>
0
Daviddavid

Lid · Topicstarter

Berichten
449
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Milan schreef:
Ik gebruik deze functie voor gedichtjestijd.nl:
[COLOR= #0000BB]<?php[/COLOR]

[URL="http://www.php.net/class"]class[/URL] core [COLOR= #007700]{[/COLOR]
    
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] parseUrl[COLOR= #007700]([/COLOR][COLOR= #0000BB]$input[/COLOR][COLOR= #007700])
    {[/COLOR]
        
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/stripslashes"]stripslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000] [/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]-[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]?[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]![/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]@[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]#[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]$[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]%[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]&[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000],[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        
        [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700];
        
    }
    
}[/COLOR]

[COLOR= #0000BB]$core[/COLOR] [COLOR= #007700]= new[/COLOR] core[COLOR= #007700];[/COLOR]

?>


Je kan hem zo aanroepen:

[COLOR= #0000BB]<?php[/COLOR]

[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$core[/COLOR][COLOR= #007700]->[/COLOR]parseUrl[COLOR= #007700]([/COLOR][COLOR= #DD0000]seo@onvriendelijke"url[/COLOR][COLOR= #007700]);[/COLOR]

?>


Oke en als je dan tekens zoals: ñ en À‘ en á krijgt?
0
Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]

[URL="http://www.php.net/class"]class[/URL] core [COLOR= #007700]{[/COLOR]
    
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] parseUrl[COLOR= #007700]([/COLOR][COLOR= #0000BB]$input[/COLOR][COLOR= #007700])
    {[/COLOR]
        
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/stripslashes"]stripslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000] [/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]-[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]?[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]![/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]@[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]#[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]$[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]%[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]&[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000],[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$input[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);[/COLOR]
        
        [URL="http://www.php.net/return"]return[/URL] htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$input[/COLOR][COLOR= #007700]);
        
    }
    
}[/COLOR]

[COLOR= #0000BB]$core[/COLOR] [COLOR= #007700]= new[/COLOR] core[COLOR= #007700];[/COLOR]

?>
0
Daviddavid

Lid · Topicstarter

Berichten
449
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Heel erg bedankt!
0
Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik gebruik deze, kan je gewoon in een class zetten.

[COLOR= #0000BB]<?php[/COLOR]
    
    [URL="http://www.php.net/public"]public[/URL] [COLOR= #007700]function[/COLOR] link_replace[COLOR= #007700]([/COLOR][COLOR= #0000BB]$strLink[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$intFilter[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]2[/COLOR][COLOR= #007700])
    {[/COLOR]
        
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$intFilter[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700])
        {[/COLOR]
            
            [COLOR= #0000BB]$strLink[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000] [/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]-[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$strLink[/COLOR][COLOR= #007700]);[/COLOR]
            [COLOR= #0000BB]$strLink[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]&nbsp;[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]-[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$strLink[/COLOR][COLOR= #007700]);
        
        }[/COLOR]
        [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$intFilter[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]2[/COLOR][COLOR= #007700])
        {[/COLOR]
            
            [COLOR= #0000BB]$strLink[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]-[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000] [/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$strLink[/COLOR][COLOR= #007700]);
        
        }[/COLOR]
        [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$intFilter[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]3[/COLOR][COLOR= #007700])
        {[/COLOR]
            
            [COLOR= #0000BB]$strLink[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000].[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]-[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$strLink[/COLOR][COLOR= #007700]);
        
        }[/COLOR]
        [URL="http://www.php.net/else"]else[/URL]
        [COLOR= #007700]{[/COLOR]
            
            [URL="http://www.php.net/return"]return[/URL] false[COLOR= #007700];
        
        }[/COLOR]
        
        [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$strLink[/COLOR][COLOR= #007700];
    
    }[/COLOR]
?>
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren