Page 1 of 1

How to add php code into a page?

Posted: Fri Nov 09, 2007 2:18 pm
by ellaissad
Stupid question..

I need to add the google stats php include code into my pages. But when I try to add this via "html" mode in the editor, it seems to erase my code everytime.

   
   


Where can I put php code into a page without modifying the template?

Thanks!

Re: How to add php code into a page?

Posted: Fri Nov 09, 2007 3:49 pm
by calguy1000
This question is an FAQ and has been answered dozens of times on this forum, and I believe it's also answered in the wiki.

Re: How to add php code into a page?

Posted: Fri Nov 09, 2007 6:41 pm
by streever
I might be wrong calguy, I think his problem is most of the forum tells you how to add it to Template: but he looks like he needs to add it to PAGES.

If you CAN access the template, PLEASE put it there--it will make your life more easy. Otherwise, you should create a UDT (user defined tag) as is outlined elsewhere in the forums.

Simply create a udt called (whatever) and paste in your google code. Then, you call the tag by typing, {thename} into your pages--whatever you called it, surrounded by {}.

i hope that helps.

Re: How to add php code into a page?

Posted: Fri Nov 09, 2007 7:00 pm
by calguy1000
The same methods for adding php code to templates (either via a udt, or using {php} and {/php} ) will work in a content block.

Re: How to add php code into a page?

Posted: Sat Nov 10, 2007 6:38 pm
by streever
yea, I think he just can't access templates? would help if he'd post back and let everyone know