Why do you keep doing this? We have told you how to do it yet you refuse to listen.Still wont replace the {site_domain} with its value -.-PHP Code:function replace($string)
{
$pattern[0] = "{site_domain}";
$pattern[1] = "{site_name}";
$replacement[0] = "$site_domain";
$replacement[1] = "$site_name";
ksort($pattern);
ksort($replacement);
str_replace($pattern, $replacement, "$string");
return $string;
}
Maybe if you listened to what we're trying to tell you it would.Still wont replace the {site_domain} with its value -.-PHP Code:function replace($string)
{
$pattern[0] = "{site_domain}";
$pattern[1] = "{site_name}";
$replacement[0] = "$site_domain";
$replacement[1] = "$site_name";
ksort($pattern);
ksort($replacement);
str_replace($pattern, $replacement, "$string");
return $string;
}
I dont see the point in this thread if your ignoring everything we suggest.
Coming and going...
Highers are getting the better of me
You actually havent suggested anything :S
Sangreal / Romanity ~ Habbo UK & USA
[OurHabbo.Net Owner]
Lewis. (Formerly xRoyal15)
Well maybe i was giving to much credit in assuming you knew how to correctly use a function as you appear to have ignored almost everything thats been said.. This example "Should" work.
*correct me if wrong i aint done php in agesPHP Code://Create all the vars
$information = "i like to eat {food} while drinking a glass of {drink}";
$myfood = "waffles";
$mydrink = "bleach";
function replace($string)
{
$pattern[0] = "{food}";
$pattern[1] = "{drink}";
$replacement[0] = $myfood;
$replacement[1] = $myfrink;
$string = str_replace($pattern, $replacement, $string);
return $string;
}
$information = replace($information);
echo $information;
}
Last edited by Mentor; 23-12-2007 at 06:18 PM.
Thats the function i had anyway....
Gets the info from the database... runs..
$templateHTML = replace($nav[templateHTML]);
echo "$templateHTML";
But still doesnt change it... i dont think the problem is with the function .. out of the function it works, put it in a function and it breaks????
Sangreal / Romanity ~ Habbo UK & USA
[OurHabbo.Net Owner]
Lewis. (Formerly xRoyal15)
You get $nav[templateHTML] how? Also you DO NOT need to inclose lone variables in quotation marks fgs. Just slows your script down.
I get it with the query...
The query works, because the template is echoed out, but it wont change the variables before it does...
Sangreal / Romanity ~ Habbo UK & USA
[OurHabbo.Net Owner]
Lewis. (Formerly xRoyal15)
fgs
PHP Code:<?php
//Create all the vars
$information = "i like to eat {food} while drinking a glass of {drink} then shopping in {store}";
function replace($string)
{
$myfood = "waffles";
$mydrink = "bleach";
$store = "Wal-Mart";
$find = array("{food}", "{drink}", "{store}");
$replace = array($myfood, $bleach, $store);
$string = str_replace($find, $replace, $string);
return $string;
}
$information = replace($information);
echo $information;
?>
Thats what i got...
All variables are already defined.... but the function wont work... it physically does doesnt change it to anything. Your all saying the same thing, and im saying if you listen, its not working...PHP Code:function replace($string)
{
$pattern = array("{site_domain}", "{site_name}");
$replacement = array("$site_domain", "$site_name");
str_replace($pattern, $replacement, $string);
return $string;
}
Sangreal / Romanity ~ Habbo UK & USA
[OurHabbo.Net Owner]
Lewis. (Formerly xRoyal15)
Want to hide these adverts? Register an account for free!