$str1 = array('[gallery]','[enquiry]');
$str2 = "include('modules/gallery/index.php');";
str_replace($str1, $str2, $target);
This will do the same for you, provided $target is the target string inside which you want to do the replacement.
try to escape the '/' inside the string if it troubles
network18
Practically a Master Poster
619 posts since Sep 2009
Reputation Points: 29
Solved Threads: 76
go ahead with your code, it should work, similar as mine
network18
Practically a Master Poster
619 posts since Sep 2009
Reputation Points: 29
Solved Threads: 76
You would need to run the new string through eval to make the includes work.
Use that function with caution though. If you don't use it right there are huge security risks.
kkeith29
Nearly a Posting Virtuoso
1,357 posts since Jun 2007
Reputation Points: 235
Solved Threads: 194
You would need to run the new string through eval to make the includes work.
Use that function with caution though. If you don't use it right there are huge security risks.
kkeith29
Nearly a Posting Virtuoso
1,357 posts since Jun 2007
Reputation Points: 235
Solved Threads: 194
can you post the part of your code here, we will modify it
network18
Practically a Master Poster
619 posts since Sep 2009
Reputation Points: 29
Solved Threads: 76
Hmmm, am I missing something as I don't understand why you are doing it that way why not make your path then include it...
$path = "includes/" . $pager['code'] . "/index.php";
include( $path );
As an example.
As I said I might have missed something.
Froger93
Junior Poster in Training
74 posts since Sep 2009
Reputation Points: 11
Solved Threads: 6