Forum Moderators: coopster

Message Too Old, No Replies

inserting php code with "eregi replace" function

inserting php code with "eregi_replace" function

         

php4U

4:21 am on Sep 26, 2007 (gmt 0)

10+ Year Member



A little background...Rather than using an iframe in FCKeditor within my CMS system I located the line of code where I can directly place text that outputs to the correct place within the whole site.(templates stay intact and so forth)

I found this...which BTW is within php tags - also <% main %> is element in seperate template file.


$template = eregi_replace("<% main %>", "$main", $template);

and replaced $main with this and it correctly shows on the site.


$template = eregi_replace("<% main %>", "ABC testing content", $template);

I can also insert image tags to display those as well...but the main thing I want to be able to do is build a seperate page in php (say a calendar for ex.) and include it above between the quotes. I tried the usual include method without any success...so I am sure there might be some syntax I am missing although I didn't get any parse errors.

I can post more code if need be, but I wanted to see if anyone had any possible solutions as I don't want to have to paste a whole page of coding in between the quotes I would like to just "include" it. (may not be possible with the structure of the template var)

Thank you for any help,
Brad

vincevincevince

4:55 am on Sep 26, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Not directly with eregi_replace I'm afraid. You could probably have a second set of replaces which will look for a dedicated include syntax which you could create yourself.

php4U

4:56 pm on Sep 26, 2007 (gmt 0)

10+ Year Member



Thank you for the reply. I found that it looks like "eregi replace" function strips extra spaces, which would make since because the FCKeditor code output is inserted into that section. I tried some things late last night, but when I removed the <% main %> the rest of the template disappeared. I'll give some other things a shot tonight to see what I can come up with. In the meantime I have found another CMS that may suite the needs of what I am looking for. Thanks again.