embedding my own php & smarty tags?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
elly

embedding my own php & smarty tags?

Post by elly »

Hi! I'm just getting CMS set up on a couple of sites. It's great and I'm loving it.

Couple of questions:

1. I have a chunk of PHP that I wrote that displays an 'on' state for top level navigation based on the REQUEST_URI. How can I easily embed this PHP in every page of my site? I wanted to install it as a module and then call the module in the default template, but I can't find any info on how to get CMS to "see" the PHP as a module once I place the php files in the /modules/ directory.

2. Is CMS written on top of PHPSmarty? If so, does this mean I can use Smarty tags in the templates, such as Smarty's {foreach} and {if} statements?

Thanks in advance!
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: embedding my own php & smarty tags?

Post by calguy1000 »

I can answer #1 for you..... create an html blob, put your php code in there (be sure to put the around it).  Then put that html_blob into your template or into each page wherever you want it.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: embedding my own php & smarty tags?

Post by Ted »

And I'll take #2.

Yes, it's built right on top of smarty.  So all of the normal stuff will work as expected (well, not totally true.  0.10.x does some hacks with the {content}, {stylesheet} and {html_blob} tags...  but otherwise it's all smarty)
Sererena

Re: embedding my own php & smarty tags?

Post by Sererena »

calguy1000 wrote: I can answer #1 for you..... create an html blob, put your php code in there (be sure to put the around it).  Then put that html_blob into your template or into each page wherever you want it.
I tried this with an include tag() but it doesn't actually execute it... There's basically a few files I need to have included, and normally I use an SSI include, but it doesn't seem to be working... any ideas?
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: embedding my own php & smarty tags?

Post by Ted »

Yeah, Pat's right.  PHP code doesn't work in an html blob.  Do the user defined tag as she said and it will work fine.
Locked

Return to “CMSMS Core”