Welcome to Geeklog Thursday, October 22 2020 @ 12:32 am EDT

Geeklog Forums

php in footer.thtml


Status: offline

jannetta

Forum User
Chatty
Registered: 22/01/03
Posts: 44
Hi folks

I was just busy working on a theme that I want to use for a client. They want banners on their site for advertising. In putting a demo site together, I wanted to put banners, served from phpAdsNew in the header, the footer and in a block. I tried two options, Remote Invocation and Local Mode. The Remote Invocation works perfectly in all three cases, because it is just html. The Local Mode works in header.thtml but in footer.thtml the php code is not interpreted.

So now a few questions:

  1. Why is php not interpreted in the footer?

  2. Would you guys reading this, who have implemented phpAdsNew in Geeklog mind telling me how you have done it? All ideas recommendations welcome.

  3. Would it be possible to write code to create a new {var} that could be embedded in the header and footer templates? If so, where would this code go? After a quick look it appears that the main thing that changes in the code created for local mode is the campaign id. So I'm thinking of returning the using the Local Mode code's return in {var} which would off course print the html code in the header/footer. This I might be able to extend to a plugin of some sorts, so that updating the banner code can be done through geeklog rather than embedding code in headers etc.



I hope this makes sense. Any comments will be greatly appreciated.

Regards
Jannetta
 Quote

Pat Walter

Anonymous
confused
Hi I am having the same problem. The header, footer, menue and ads section will work sometimes. But if I add any 3rd party php programs - it won't work. I get headers have already been added. Or I get the footer moving up under the ads column. I have been reading until I am blue in the face - but still don't understand php well enough to solve the problem. Did you ever figure it out?????
 Quote

Status: offline

Blaine

Forum User
Moderator
Registered: 16/07/02
Posts: 1232
Location:Canada
We are only evaluating PHP in the header. Thats the only template today that allows PHP code. Other then in your custom blocks.

It could be added to the footer. Have a look at the COM_siteHeader function and you will see a block of 4 lines of code near the end of the function that uses the PHP function eval to parse and execute any embedded PHP code in the header.thtml file.

You could add the same to the function COM_siteFooter() that is called to format the site footer. Atleast that would be my first attempt but I've not tested the idea.
Geeklog components by PortalParts -- www.portalparts.com
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 22/03/04
Posts: 1512
Quote by Blaine:
You could add the same to the function COM_siteFooter() that is called to format the site footer. Atleast that would be my first attempt but I've not tested the idea.
I've tried this and unless I missed something (highly possible) it didn't seem to work.

if you don't mind editing core files, you could always properly add your php to COM_siteFooter() and have it output a variable. add that variable to your footer.thtml and all will be well.
 Quote

Status: offline

jlawrence

Forum User
Chatty
Registered: 30/12/04
Posts: 49
Location:Plymouth, Devon, UK
I too could not get this to work. It was down to the way that COM_Footer return the resultinmg HTML.
If you add the lines for parsing the php and the change the final return line to 'return $retval' then php in the footer works.
www.plymouthcricketclub.com - providing cricket for all ages in the Plymouth area.
 Quote

All times are EDT. The time is now 12:32 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content