Can I include a php file as my header/logo?

BiTurbo27t
BiTurbo27t's picture

Joined: 2002-08-27
Posts: 19
Posted: Thu, 2005-02-24 01:08

Hi all,

I'm giving G2 a go, but have run in to a problem that's stumped me. Here's my question. I am running WordPress blog software and have created a nice header for it (header.php). I would like to include this file above the G2 header. I've poked around in the global.tpl file, but don't know enough about how to go about doing this. Can I insert a php include call somewhere, or maybe a SSI call? With G1, editing the wrap header file was fairly simple :-? I don't know enough about smarty or the new templating system. :-(

I should also note that the header.php file resides 'outside' of the Gallery2 directory and I'd prefer to keep it that way (as opposed to having duplicate files, etc.)

Any help or suggestions would be greatly appreciated. Thanks in advance!

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Thu, 2005-02-24 02:04

to put php into a smarty template put {php} ... {/php} around it.

 
BiTurbo27t
BiTurbo27t's picture

Joined: 2002-08-27
Posts: 19
Posted: Thu, 2005-02-24 02:18
mindless wrote:
to put php into a smarty template put {php} ... {/php} around it.

Thanks for the reply mindless. When I try that however, nothing loads at all. I placed the code {php}include file="http://www.myserver.com/wp-content/header.php"{/php} into the global.tpl file, trying it in various locations, but got the same result.

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Thu, 2005-02-24 02:20

Everything inside the {php} tags must be valid php! Try this:

{php}include("http://www.myserver.com/wp-content/header.php");{/php}
 
thumb
thumb's picture

Joined: 2004-05-26
Posts: 238
Posted: Thu, 2005-02-24 02:22

Looks like you're trying an apache server-side include instead of a php include. Try this instead {php}include "http://www.myserver.com/wp-content/header.php"{/php}. You may need to wrap the quoted url with parens.

 
BiTurbo27t
BiTurbo27t's picture

Joined: 2002-08-27
Posts: 19
Posted: Thu, 2005-02-24 02:34
bharat wrote:
Everything inside the {php} tags must be valid php! Try this:

{php}include("http://www.myserver.com/wp-content/header.php");{/php}

Bharat, thanks for the reply. I gave that a try, but it still doesn't load the file. Am I trying to modify the correct file?...global.tpl.local ??

Maybe this isn't possible to do?

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Thu, 2005-02-24 02:59

Oops, sorry I accidentally replied too quickly and gave you a bad example.

Don't use global.tpl.local -- that's the old system and is on the way out. Instead create a new directory and copy global.tpl into it, then modify the copy:

$ cd gallery2/templates
$ mkdir local
$ copy global.tpl local
$ cd local
$ edit global.tpl

Then inside the global.tpl file put:

{php}include("/full/path/to/wp-content/header.php");{/php}

See how we're using the path on the filesystem to WordPress's header.php, not a url.

 
BiTurbo27t
BiTurbo27t's picture

Joined: 2002-08-27
Posts: 19
Posted: Thu, 2005-02-24 03:19
bharat wrote:
Oops, sorry I accidentally replied too quickly and gave you a bad example.

Don't use global.tpl.local -- that's the old system and is on the way out. Instead create a new directory and copy global.tpl into it, then modify the copy:

$ cd gallery2/templates
$ mkdir local
$ copy global.tpl local
$ cd local
$ edit global.tpl

Then inside the global.tpl file put:

{php}include("/full/path/to/wp-content/header.php");{/php}

See how we're using the path on the filesystem to WordPress's header.php, not a url.

bharat, I've given that a try, but still no joy. I created the directory "local" inside the templates directory and moved the global.tpl copy in there to modify as you suggested, renamed to global.tpl. I tried using both a URL in the code and the absolute path, which *should* be:

{php}include("../wp-content/themes/arzel_kt2/header.php");{/php}

and that doesn't work either :( Do I need to chmod the "local" directory maybe? Or is my ablsoute path incorrect? Not sure what I'm still doing incorrectly. *sigh*

Thanks again for your help. It's really an honor to receive a reply from "the man" :) I'd sure love to get this figured out.

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Thu, 2005-02-24 04:18
BiTurbo27t wrote:
bharat, I've given that a try, but still no joy. I created the directory "local" inside the templates directory and moved the global.tpl copy in there to modify as you suggested, renamed to global.tpl. I tried using both a URL in the code and the absolute path, which *should* be:

{php}include("../wp-content/themes/arzel_kt2/header.php");{/php}

and that doesn't work either :( Do I need to chmod the "local" directory maybe? Or is my ablsoute path incorrect? Not sure what I'm still doing incorrectly. *sigh*

I need to know more than "it doesn't work". How does it fail? There are lots of reasons why it might not work so the more information you provide, the faster we can narrow it down. Start by verifying that the local override is actually working. Try making a small, visible change to the file. If that's working then try experimenting with the {php} tag. You should avoid using relative paths in your include since you can't be totally sure what the base path. It's better to use a full path instead.

BiTurbo27t wrote:
Thanks again for your help. It's really an honor to receive a reply from "the man" :) I'd sure love to get this figured out.

:-) We all do our best.. we'll help you sort this out.

 
BiTurbo27t
BiTurbo27t's picture

Joined: 2002-08-27
Posts: 19
Posted: Thu, 2005-02-24 04:53
Quote:
"I need to know more than "it doesn't work". How does it fail? There are lots of reasons why it might not work so the more information you provide, the faster we can narrow it down. Start by verifying that the local override is actually working. Try making a small, visible change to the file. If that's working then try experimenting with the {php} tag. You should avoid using relative paths in your include since you can't be totally sure what the base path. It's better to use a full path instead.

Sorry for being too vague. Essentially, what I meant was, nothing had changed appearance wise. The G2 pages still looked "stock".
I then modified the local file with something that should have show up as you suggest, but that change did not appear. So the local directory and file are not loading. So I went back to using the global.tpl file in it's default location, and my "test" text change does show up correctly, as expected.

Next, I changed the path in the php code inside the global.tpl file to "/Library/WebServer/Documents/wp-content...etc." (I assume that's what you mean by "full" path. Again, my test text shows up in the header area as expected, but the header.php file still fails to load or appear.

Quote:
:-) We all do our best.. we'll help you sort this out.

Thanks again.

 
fryfrog

Joined: 2002-10-30
Posts: 3236
Posted: Sat, 2005-02-26 00:23

Maybe you just need to clear out some of the cached content in /g2data? Don't go deleting willy nilly, but someone else who knows will probably tell ya what you should look into nuking :)

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sat, 2005-02-26 01:18

dunno if it's a cache issue, but you can clear the cache here:
http://www.pixxelated.com/gallery2/lib/tools/test/

note: clearing the cache doesn't harm your gallery / your data. but resetting / reinitializing, ... will delete all your g2 data / users.

 
BiTurbo27t
BiTurbo27t's picture

Joined: 2002-08-27
Posts: 19
Posted: Mon, 2005-02-28 04:04

Thanks for all the replies and suggestions. However, I've decided (for now at least) to try another route, by removing the links in the banner and placing them underneath the banner. I haven't tested things with different platforms and browsers, but it looks OK to me using Apple's Safari and Firefox. IE Mac does some strange things, but I don't care about that much.

Cheers and thank you again.

 
astralbaby

Joined: 2003-12-13
Posts: 35
Posted: Wed, 2005-04-20 02:40

force a php error.. then you will see the full server path.. then edit it to point to your header.php file

/usr/www.whatever.com/home/htdocs/includes/header.php

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2005-04-20 12:04

astralbaby, lol, nice method.

 
suttercain

Joined: 2006-11-01
Posts: 14
Posted: Tue, 2007-05-22 15:33

This post is old, but I am trying to do the exact same thing with no luck:

<div {g->mainDivAttributes}>
	{php}include("http://www.supermandatabase.com/head.php");{/php}
      {*
       * Some module views (eg slideshow) want the full screen.  So for those, we
       * don't draw a header, footer, navbar, etc.  Those views are responsible for
       * drawing everything.
       *}
      {if $theme.useFullScreen}
	{include file="gallery:`$theme.moduleTemplate`" l10Domain=$theme.moduleL10Domain}
      {else}

      <div id="gsNavBar" class="gcBorder1">

But this isn't working. I am using the Matrix theme and modifying the theme.tpl

Anyone know how I can include the header and footer? Thanks.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Tue, 2007-05-22 21:32

enter a filesystem path to include (like /home/you/public_html/head.php) not a URL