forum.coppermine-gallery.net

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Themes/Skins/Templates => Topic started by: nukeworker on September 14, 2005, 10:53:03 pm

Title: $section variable in theme.php function pagefooter
Post by: nukeworker on September 14, 2005, 10:53:03 pm
I want to add a line in my template.html that looks like this:
Also try searching for images on google: <a href=http://images.google.com/images?q={GOOGLE}>http://images.google.com/images?q={GOOGLE}</a>

I want this to be after the {GALLERY} tag, so I'm putting it in the pagefooter function.

Problem seems to be that $section isn't defined.  Below is my code.  Please help me. :)

Quote
// Function for writing a pagefooter
function pagefooter()
{
    global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_SERVER_VARS;
    global $USER, $USER_DATA, $ALBUM_SET, $CONFIG, $time_start, $query_stats, $queries;;
    global $template_footer;

    if ($CONFIG['debug_mode']==1 || ($CONFIG['debug_mode']==2 && GALLERY_ADMIN_MODE)) {
    cpg_debug_output();
    }

$template_vars = array(
        '{GOOGLE}' => urlencode($CONFIG['gallery_name'] . ' ' . $section),
);
Title: Re: $section variable in theme.php function pagefooter
Post by: nukeworker on September 15, 2005, 03:35:44 pm
The code works just dandy in the header portion, I just cant get the $section variable to work in the footer.  Please tell me how to get that veriable initialized.
Title: Re: $section variable in theme.php function pagefooter
Post by: nukeworker on September 15, 2005, 04:37:14 pm
I guess I'll give up.  I'll just put it at the top of the page, here is the code I'm using to google for more images. (I use this to look for more images on the subject, so I can add them to our galery easily.

In template.html

Change
Code: [Select]
{MAIN_MENU}To
Code: [Select]
{MAIN_MENU}
<br><a href=http://images.google.com/images?q={GOOGLE}>Google for More Images.</a>

In theme.php

Change
Code: [Select]
        '{TITLE}' => $CONFIG['gallery_name'] . ' - ' . $section,TO
Code: [Select]
        '{TITLE}' => $CONFIG['gallery_name'] . ' - ' . $section,
        '{GOOGLE}' => urlencode($CONFIG['gallery_name'] . ' ' . $section),

This works for me, but you may need to change your key words a little.
Title: Re: $section variable in theme.php function pagefooter
Post by: kegobeer on September 15, 2005, 07:45:21 pm
Please respect board rules and don't bump for at least a day.  This isn't a hotline.  Have you searched the boards?  I'm sure there are plenty of posts dealing with placeholders you can read until someone has the time to look into the template system.  As I'm at work I don't have access to my files.
Title: Re: $section variable in theme.php function pagefooter
Post by: nukeworker on September 15, 2005, 09:41:04 pm
Please respect board rules and don't bump for at least a day.  This isn't a hotline.  Have you searched the boards?  I'm sure there are plenty of posts dealing with placeholders you can read until someone has the time to look into the template system.  As I'm at work I don't have access to my files.
Kegobeer,

I've been using coppermine for a long time, and have given little contributions along the way when I could.  (I'm just ignorant when it comes to the finer details of PHP/coppermine).

I most deffinatly did search the messages boards with multiple keywords, and read every message.  This particular subject was not discussed.
Title: Re: $section variable in theme.php function pagefooter
Post by: kegobeer on September 16, 2005, 03:16:13 am
$section is loaded from wherever the pageheader is called.  You can do this to grab and keep the $section variable:

In theme.php, in function pageheader, add this:

Code: [Select]
global $keepsection;
$keepsection = $section;

In function pagefooter, add this:

Code: [Select]
global $keepsection;
Now you have the section in your footer.  If you explain how you want it displayed (ie, at the very bottom after the tag line, just under the gallery, etc) I can show you how to do that.
Title: Re: $section variable in theme.php function pagefooter
Post by: kegobeer on September 16, 2005, 03:31:16 am
To just display it right above the tag line, do this:

Code: [Select]
    $google = urlencode($CONFIG['gallery_name'] . ' ' . $keepsection);
echo '
<div class="footer">
<a href=http://images.google.com/images?q=', $google, '>http://images.google.com/images?q=', $google, '</a>
</div>
';
    echo $template_footer;
Title: Re: $section variable in theme.php function pagefooter
Post by: nukeworker on September 16, 2005, 05:44:43 pm
Thanks Kegobeer, I knew it was simple, it was just alluding me.