forum.coppermine-gallery.net

Support => Older/other versions => cpg1.2 Standalone Support => Topic started by: ojohn on December 03, 2003, 08:37:30 am

Title: How can i put sponsors for different album/cats?
Post by: ojohn on December 03, 2003, 08:37:30 am
How can i put sponsors for different album/cats?
Title: How can i put sponsors for different album/cats?
Post by: Joachim Müller on December 03, 2003, 09:44:50 am
you could use the anycontent.php block for this:
add some code like this into it:
Code: [Select]
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
Title: How can i put sponsors for different album/cats?
Post by: DefenceTalk.com on December 03, 2003, 07:15:36 pm
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
Title: How can i put sponsors for different album/cats?
Post by: Joachim Müller on December 03, 2003, 07:38:07 pm
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
Title: How can i put sponsors for different album/cats?
Post by: sbpoole on December 03, 2003, 10:53:20 pm
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
Title: How can i put sponsors for different album/cats?
Post by: Joachim Müller on December 04, 2003, 08:58:50 am
well, looking into it I must confess you're right: anycontent does not show on all pages.
I started a tracker # 853886 (http://sourceforge.net/tracker/index.php?func=detail&aid=853886&group_id=89658&atid=590910) on this.

GauGau
Title: How can i put sponsors for different album/cats?
Post by: Oasis on December 04, 2003, 09:10:38 am
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
Code: [Select]
case 'anycontent';
and remove the
Code: [Select]
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.  :)
Title: How can i put sponsors for different album/cats?
Post by: Joachim Müller on December 04, 2003, 09:16:31 am
@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
Title: How can i put sponsors for different album/cats?
Post by: Oasis on December 04, 2003, 10:53:44 am
@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
Code: [Select]
pageheader(isset($CURRENT_ALBUM_DATA) ? $CURRENT_ALBUM_DATA['title'] : $lang_meta_album_names[$album]);
add AFTER it:
Code: [Select]
$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:
Code: [Select]
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
Code: [Select]
pageheader($album_name.'/'.$picture_title, '', false);
add AFTER it:
Code: [Select]
$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:
Code: [Select]
pagefooter();
ob_end_flush();



OK thats all. Hope it works for you.
Title: How can i put sponsors for different album/cats?
Post by: ojohn on December 05, 2003, 05:13:29 am
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';}
Title: How can i put sponsors for different album/cats?
Post by: Joachim Müller on December 05, 2003, 09:47:18 am
You should know a little HTML to make this work, of course like this:
Code: [Select]
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
Title: How can i put sponsors for different album/cats?
Post by: ojohn on December 05, 2003, 05:51:24 pm
Never mind i got it to just the way i need thanks for all your help. :D
Title: How can i put sponsors for different album/cats?
Post by: Joachim Müller on December 05, 2003, 10:15:47 pm
@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
Title: How can i put sponsors for different album/cats?
Post by: ojohn on December 06, 2003, 08:28:40 am
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?
Title: How can i put sponsors for different album/cats?
Post by: Oasis on December 06, 2003, 10:34:29 am
link?
Title: How can i put sponsors for different album/cats?
Post by: Joachim Müller on December 06, 2003, 12:00:44 pm
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
Title: How can i put sponsors for different album/cats?
Post by: ojohn on December 07, 2003, 01:36:30 am
@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:

Code: [Select]
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.
Title: How can i put sponsors for different album/cats?
Post by: ojohn on December 10, 2003, 01:56:29 am
@oasis: I did what you said on display the anycontent on everypage but what do i use in the anycontent?
Title: How can i put sponsors for different album/cats?
Post by: ojohn on December 21, 2003, 08:59:26 am
oasis pls i need help
Title: How can i put sponsors for different album/cats?
Post by: Oasis on December 21, 2003, 05:39:12 pm
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.
Title: How can i put sponsors for different album/cats?
Post by: ojohn on December 21, 2003, 09:01:17 pm
oasis: So for each album i create ill have to go back to anycontent and it in?
Title: How can i put sponsors for different album/cats?
Post by: Oasis on December 21, 2003, 09:11:07 pm
no no... you remove all conditionals (ifs), and see if anycontent actually appears AT ALL in displayimage.php and thumbnails.php

If it DOES, then we can get moving with this.
It it DOESN'T, you have obviously missed some part of the changes
Title: How can i put sponsors for different album/cats?
Post by: ojohn on December 21, 2003, 09:25:47 pm
oasis: It didn't work heres a link:

http://www.maderacoyotes.com/photos/index.php?cat=4
Title: How can i put sponsors for different album/cats?
Post by: ojohn on December 22, 2003, 12:02:18 am
oasis: it did work but i need it to show in the cats.

Link
http://www.maderacoyotes.com/photos/
Title: How can i put sponsors for different album/cats?
Post by: Tarique Sani on December 22, 2003, 04:47:52 am
Oops! missed a lot on this thread - My intention of putting anycontent was showing some additional content like a small blurb, news headline etc on the first page of your site - and it does precisely that.

Removing conditionals will only make it appear on the pages which are handled by index.php - thats about it

If functionality like banner / sponsor per album etc is to be added I would prefer that it be done in a separate mod and not by mangling anycontent.php

anycontent.php is a simple tool - lets keep it simple :)
Title: How can i put sponsors for different album/cats?
Post by: ojohn on December 22, 2003, 05:29:03 am
tarique: well that not going to help
Title: How can i put sponsors for different album/cats?
Post by: Tarique Sani on December 22, 2003, 09:01:05 am
Quote from: "ojohn"
tarique: well that not going to help

My comments were directed at the devs here who have been trying to help you
Title: How can i put sponsors for different album/cats?
Post by: ojohn on December 22, 2003, 09:25:02 pm
oasis: This is what i got in the index.php

            case 'anycontent';
                include('anycontent.php');
                flush();
                break;

Is that right?
Title: How can i put sponsors for different album/cats?
Post by: Oasis on December 23, 2003, 10:18:16 am
@tarique: I already noticed that anycontent was only being displayed in index.php, so I told ojohn to add the includes to thumbnails.php and displayimage.php, so now they should appear there as well.  :)
The conditionals I was talking about are those that gaugau suggested putting in anycontent.php, so that the appropriate banners will appear for the albums/category that is being shown.

@ojohn: I looked at your site yesterday, and the "Test banner for blahblah" was there, but now they are not. Did you remove EVERYTHING from anycontent? If there is nothing in anycontent, well, how can you expect anything to show up?
Title: How can i put sponsors for different album/cats?
Post by: ojohn on December 23, 2003, 08:06:48 pm
oasis: NO click in a cat. And when you click on a cat it shows but when you click on album its gone.
Title: How can i put sponsors for different album/cats?
Post by: Oasis on December 23, 2003, 09:41:29 pm
Please post constructively, I can hardly understand what you are saying.
1. "No click in a cat". What on earth does that mean?
2. "When you click on a cat it shows". Well from what I see it surely doesn't.
3. "When you click on album it's gone" Well, obviously you didn't put it correctly in thumbnails.php, because in displayimage.php it seems to be showing just fine (http://www.maderacoyotes.com/photos/displayimage.php?album=random&cat=4&pos=-146)

4. I told you to remove all conditionals (ifs) in anycontent, yet the banner is showing in some pictures and not in others(this one shows the banner: http://www.maderacoyotes.com/photos/displayimage.php?album=random&cat=5&pos=-104 and this one doesn't show the banner: http://www.maderacoyotes.com/photos/displayimage.php?album=10&pos=0) which means you didn't even bother to follow the instructions I gave you. If you can't even follow instructions properly, I will no longer waste my time.
Title: How can i put sponsors for different album/cats?
Post by: ojohn on December 24, 2003, 05:00:27 am
oasis: Don't know how you can say I didn't follow your instructors when there are mistakes in them so maybe if you could go back and see if you can get it to work right. :wink:
Title: How can i put sponsors for different album/cats?
Post by: Oasis on December 24, 2003, 05:51:11 am
:evil: What do you mean by there were mistakes in them. I gave you explicit instructions: REMOVE ALL CONDITIONALS FROM ANYCONTENT.PHP.

You would have found no mistakes in my instructions IF YOU HAD ACTUALLY FOLLOWED THEM. These are the exact changes I have made to my own code, and everything is working right for me.

So maybe it is YOU who should go back and see if you can get it to work right. Sorry, but since you are obviously not making any effort to follow my instructions, I do not see why I should waste my time or make any effort to write them. So you're on your own now. Good Luck.
Title: How can i put sponsors for different album/cats?
Post by: ojohn on December 26, 2003, 05:03:57 am
Sorry but how should they be:

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

into

($_REQUEST["cat"] == 5){print 'Cheer Sponsor Banner Test';}

please answer my last question...
Title: Re: How can i put sponsors for different album/cats?
Post by: dustyb on May 06, 2004, 07:24:56 pm
Oasis, thanks for your helpful hints on using anycontent.php in pages other than index.php. I guess that is going far beyond the original intent of the include, but that's another matter. I'm relatively new to PHP, more of a Linux system engineer and Perl Module guy myself. I'm trying to study exactly how your templating engine works in this program. Basically, I've wrapped my site navigation around {GALLERY} using template.html (pretty much as it was designed). My pages look like this through template.html:

My Top Nav
My Left Nav        {GAL_NAME}       My Right Column
                         {GALLERY}

I've done a fair amount of tweaking within theme.php, adding a couple of menu items, fixing some bad html, etc. But what I really need to get a skyscraper banner ad in that Right Column. The Right Column would only be the Skyscraper, nothign else. Ideally, I'd like to get something like {SKYSCRAPER} parsed in the template.html. I guess that is where I bump up against my understanding of the program.

So, another solution I suppose would be to use pagefooter() and let it do the footer, and then after that include anycontent.php which would open the right column cell, call the skyscaper, close the cell, row, and table. In other words, use template.html for first half, and then use pagefooter() and anycontent.php to finish it all off.

Sound right? Any other suggestions? Or quick pointers on how to get {SKYSCRAPER} into template.html? Much appreciated. Excellent program to all involved, really.

Title: Re: How can i put sponsors for different album/cats?
Post by: Joachim Müller on May 07, 2004, 08:01:27 am
your suggestion is correct, since you can't add any custom functions after the pagefooter tag (that's where the parsing of template html stops "looking" for stuff in curly braces). Either include your skyscraper code within pagefooter or have the three columns end before the footer, like you sugested.
See http://forum.coppermine-gallery.net/index.php?topic=5555.0 and http://coppermine.sourceforge.net/faq.php?q=rightHandMenu#rightHandMenu

GauGau