%gebruikersnaam%

Gestart doorMarvinn19 reacties48 weergaven

20 berichten · pagina 1 van 2

Marvinn

Lid · Topicstarter

Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hooi!

Ik zoek een script dat als ik Hooi %gebruikersnaam% typ dat ik dan krijg:

Hooi Nickjexx

Zou dat kunnen in php?

Als iemand een link naar een pagina hebt ofzo graag smile
Tnx biggrin
0
Berichten
3.788
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dit moet je doen met str_replace.
Wat dit doet is hij zoekt een bepaald iest, en vervangt het dan, dus dan krijg je zoeits:

[COLOR= #0000BB]<?php
$naam[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]Eleky[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$string[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]Welkom %gebruikersnaam%[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$string[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]%gebruikersnaam%[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$naam[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$string[/COLOR][COLOR= #007700])[/COLOR]
?>


Hoop dat je het zo snapt, zal er nog even bijzetten wat wat is
str_replace(zoekstring, vervangenmet, stringwaaringezochtword)
0
Berichten
2.692
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Kan ook met ob en das handiger denk ik, voorbeeld:

[COLOR= #0000BB]<?php
$naam[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]Bas[/COLOR][COLOR= #007700];
function[/COLOR] handler[COLOR= #007700]([/COLOR][COLOR= #0000BB]$str[/COLOR][COLOR= #007700]){[/COLOR]
[COLOR= #0000BB]$str[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]%gebruikersnaam%[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$naam[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$str[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$str[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/ob_start"]ob_start[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]handler[/COLOR][COLOR= #007700]);[/COLOR]
?>
hier het hele script met
hoi %gebruikersnaam%!
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/ob_end_flush"]ob_end_flush[/URL][COLOR= #007700]();[/COLOR]
?>
0
Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dankjewel Bas en Eleky, had ik ook nodig
0
Berichten
4.912
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
hoe kan het dat het bij mij niet werkt?
0
Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Omdat je faalt emo Nee grapje, laat je code eens zien.
0
Berichten
4.912
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]inc/config.php[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$naam[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]Bas[/COLOR][COLOR= #007700];
function[/COLOR] handler[COLOR= #007700]([/COLOR][COLOR= #0000BB]$str[/COLOR][COLOR= #007700]){[/COLOR]
[COLOR= #0000BB]$str[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]%gebruikersnaam%[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$naam[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$str[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$str[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/ob_start"]ob_start[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]handler[/COLOR][COLOR= #007700]);[/COLOR]
?>
hier het hele script met
hoi %gebruikersnaam%!
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/ob_end_flush"]ob_end_flush[/URL][COLOR= #007700]();[/COLOR]
?>


hij weergeeft Bas niet?
hier het hele script met hoi !
staat er dan
0
Berichten
9.969
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Smiegles schreef:
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]inc/config.php[/COLOR][COLOR= #007700];
function[/COLOR] handler[COLOR= #007700]([/COLOR][COLOR= #0000BB]$str[/COLOR][COLOR= #007700]){[/COLOR]
[COLOR= #0000BB]$naam[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]Bas[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$str[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]%gebruikersnaam%[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$naam[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$str[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$str[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/ob_start"]ob_start[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]handler[/COLOR][COLOR= #007700]);[/COLOR]
?>
hier het hele script met
hoi %gebruikersnaam%!
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/ob_end_flush"]ob_end_flush[/URL][COLOR= #007700]();[/COLOR]
?>
hij weergeeft Bas niet?
hier het hele script met hoi !
staat er dan

$naam hoort volgensmij binnen de function te staan.
0
Berichten
4.912
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
dankjewel dat werkt welbiggrin
0
Marvinn

Lid · Topicstarter

Berichten
2.609
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Robbert schreef:
Eerdere citaten tonen
Smiegles schreef:
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]inc/config.php[/COLOR][COLOR= #007700];
function[/COLOR] handler[COLOR= #007700]([/COLOR][COLOR= #0000BB]$str[/COLOR][COLOR= #007700]){[/COLOR]
[COLOR= #0000BB]$naam[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]Bas[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$str[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]%gebruikersnaam%[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$naam[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$str[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$str[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/ob_start"]ob_start[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]handler[/COLOR][COLOR= #007700]);[/COLOR]
?>
hier het hele script met
hoi %gebruikersnaam%!
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/ob_end_flush"]ob_end_flush[/URL][COLOR= #007700]();[/COLOR]
?>
hij weergeeft Bas niet?
hier het hele script met hoi !
staat er dan
$naam hoort volgensmij binnen de function te staan.

Ik snap hem niet. Waar moet hij nu komen te staan dan?
0
Berichten
3.314
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik zou voor de Eleky versie gaan zonder ob_start.
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
die ob_ functies zijn niet aangeraden om te gebruikenwink
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Raoulfloks schreef:
die ob_ functies zijn niet aangeraden om te gebruikenwink
Waarom niet?
0
Berichten
2.692
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
ja waarom niet? Het werkt perfect hoor..
0
Berichten
3.788
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Superb schreef:
ja waarom niet? Het werkt perfect hoor..
Klopt, maar denk dat die manier van mij wat makkelijker is, aangezien het veel minder regels gebruikt, en wat vanzelf sprekender is
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