How can i put sponsors for different album/cats? How can i put sponsors for different album/cats?
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

How can i put sponsors for different album/cats?

Started by ojohn, December 03, 2003, 08:37:30 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ojohn

How can i put sponsors for different album/cats?

Joachim Müller

you could use the anycontent.php block for this:
add some code like this into it:if ($_REQUEST["album"] ==1){print 'This album was brought to you by foo bar';}
elseif ($_REQUEST["album"] ==2){print 'This album was brought to you by another sponsor';}
if ($_REQUEST["cat"] ==5){print 'This category can only be maintained in the future if you buy products from xyz company';}
You get the idea....

If you need a more sophisticated software to handle this, search hotscripts or some other script ressources page for "banner rotation".

GauGau

DefenceTalk.com

Well, how do you make "anycontent.php" appear only when that album is clicked?

It would be nice to see this as part of the gallery software(future plan perhaps?).  :D
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.defencetalk.com%2Fpictures%2Fsignature_cpg.php&hash=c0098ed5314d39beb9e8799c7c8787a9a0353b45)

Joachim Müller

you seem not to have understood the concept:
anycontent is being included on each and every page - this is by design and is what you call "expected behaviour".
The file anycontent.php as it comes with the coppermine package doesn't do anything at all - it's empty.
If you put some code into it, it will be run on every page.

Solution: put some code into it that actually has conditions (see my above code example: "if"--> "then"). This mechanism is responsible to get something displayed under circumstances or not - it's up to you to code whatever you can think of.

Of course anycontent.php is meant to be used by people who know at least a little php...

GauGau

sbpoole

I use anycontent at the top of my website and anycontent2 at the bottom.  They only show up on the home (index.php) page.  No other page shows them except for the home page.  Am I missing something?  I would like them to show up on all pages if possible.  Thanks

Joachim Müller

well, looking into it I must confess you're right: anycontent does not show on all pages.
I started a tracker # 853886 on this.

GauGau

Oasis

anycontent was not meant to show up on pages other than index.php

If you want it to appear on everypage, in index.php find
case 'anycontent';
and remove the
if ($cat == 0){
after it, and the "}" after "include('anycontent.php');"

you will have to add code to thumbnails.php and displayimage.php too
but since for some reason I can't use my copy paste right now,
you'll have to wait until I restart my computer.  :)
Pixnet Gallery: http://www.pixnet.net
iNSiGNiA Weblog: http://www.jayliu.org

Joachim Müller

@oasis: as you're already working on this, please take over the tracker (I originally assigend it to Tarique, since he was the author of anycontent). Please make up your mind if this can be turned into an admin settable option (anycontent on all pages or index only...).

Thanks

GauGau

Oasis

@gaugau: Sorry, I won't be able to make it an admin settable option to put it on every page, because the content on main page tag does not control "thumbnails.php" or "displayimages.php". This is just like the toprated blocks, random blocks, etc won't show up in thumbnail view or picture view.I can only make an admin settable option to put it on all "index.php" pages, that is mainpage, category view, and album view. To make them appear in when viewing thumbnails and individual pictures the will have to add the code manually.

@sbpoole: OK, let's continue now that I can copy paste again..
If you altered the code as I posted earlier, you will have the anycontent block appearing now on all pages called from index.php: Main page, Category Listing, Album Listings.

Now, if you want it to appear when you are INSIDE an album, do this:

1. If you want the block to appear at the TOP of the page:
thumbnails.php:
Find
pageheader(isset($CURRENT_ALBUM_DATA) ? $CURRENT_ALBUM_DATA['title'] : $lang_meta_album_names[$album]);
add AFTER it:
$elements = preg_split("|/|", $CONFIG['main_page_layout'], -1, PREG_SPLIT_NO_EMPTY);
foreach ($elements as $element){
        if (preg_match("/(\w+),*(\d+)*/", $element, $matches))        switch($matches[1]){
                case 'anycontent':
                include('anycontent.php');
                break;
}
}


2. If you want the block to appear at the BOTTOM of the page:
place the same code BEFORE:
pagefooter();
ob_end_flush();



if you want the block to appear when you are looking at an INDIVIDUAL PICTURE:

1. TOP of the page:
displayimage.php:
Find
pageheader($album_name.'/'.$picture_title, '', false);
add AFTER it:
$elements = preg_split("|/|", $CONFIG['main_page_layout'], -1, PREG_SPLIT_NO_EMPTY);
foreach ($elements as $element){
        if (preg_match("/(\w+),*(\d+)*/", $element, $matches))        switch($matches[1]){
                case 'anycontent':
                include('anycontent.php');
                break;
}
}


2. If you want the block to appear at the BOTTOM of the page:
place the same code BEFORE:
pagefooter();
ob_end_flush();



OK thats all. Hope it works for you.
Pixnet Gallery: http://www.pixnet.net
iNSiGNiA Weblog: http://www.jayliu.org

ojohn

So how can i add

<script src="Banners/3SideBanner/bronze.js" type="text/javascript"></script>

into this:

if ($_REQUEST["album"] ==5){print 'This album was brought to you by foo bar';}

Joachim Müller

You should know a little HTML to make this work, of course like this: if ($_REQUEST["album"] ==5){print '<script src="Banners/3SideBanner/bronze.js" type="text/javascript"></script>';}
Maybe you should get learn some basics first! Why don't you experiment a little before asking questions?

GauGau

ojohn

Never mind i got it to just the way i need thanks for all your help. :D

Joachim Müller

@ojohn: OK, glad you got it working for yourself.

@All: For all others reading this thread and wondering how this can be done: if you just need some plain HTML (or JavaScript) to run on every page, there's no magic at all: simply insert the HTML code in /themes/yourtheme/template.html
No need to play around with anycontent.php at all!

GauGau

ojohn

Hi

I edit the thumbnails page and the sposors don't show there like they should and not i the display image page too.

Any ideas?

Oasis

Pixnet Gallery: http://www.pixnet.net
iNSiGNiA Weblog: http://www.jayliu.org

Joachim Müller

Quote from: "ojohn"Hi

I edit the thumbnails page and the sposors don't show there like they should and not i the display image page too.

Any ideas?
You mustn't edit the php files of coppermine, read my above post: just edit template.html !

GauGau

ojohn

@oasis: I try what you said i edit and added the code into my displayimage.php
and thumbnails.php and it doesn't show up in the displayimage.php and thumbnails.php.

And another question do i need to change anything in the anycontent, what i have in it is this:

if ($_REQUEST["cat"] == 3){print 'Baseball Sponsor Banner Test';}

But like i said it only show up in the index parts and not the displayimage or
thumbnails and yes i edit the index page.

ojohn

@oasis: I did what you said on display the anycontent on everypage but what do i use in the anycontent?

ojohn


Oasis

oh gosh, sorry I didn't notice your post. I've been having my finals lately.

Could you try anycontent without the if ($_REQUEST["cat"] == 3) first?
In other words, don't restrict it to categories yet, just see if it shows up at all. My guess is that you are going have to set $_REQUEST["album"] and not $_REQUEST["cat"] if you want it to appear in displayimages and thumbnails.php, because cat is read by index.php only. thumbnails.php and displayimages.php read the "album" variable.

By the way, you still haven't given me a link I asked you for. It would be much easier if I could see the page and not just imagine it.
Pixnet Gallery: http://www.pixnet.net
iNSiGNiA Weblog: http://www.jayliu.org