How to add banners?

Hello, please, I need some help to add a custom banner for each gallery. Someone can help me?

Thank in advance.

Comments

  • acrylian Administrator, Developer
    You need to check the album title or ID and then print the specific banner with an IF statement. Use something like this on album.php:
    `if(getAlbumTitle() === "") { }`

    You need to do that for all albums you wish a specific banner to be shown.
  • Hi acrylian! Thanks for help me. I need to make 500 albums with 10 different banners, your code will use a lot of time and server resources? Maybe I can arrange in subcategories and show banners for categories.

    Thanks again.
  • acrylian Administrator, Developer
    Ok, 500 albums is a lot, maybe you could use tags for that.
  • How I can do that?
  • You would invent a "tag" for each of the 10 different banners. In Admin you would edit each of the albums and assign the tag of the banner you want displayed. Then on your album page you would include code to check that the tag of the album and display the appropriate banner. If you are careful to assign only the tag for the banner, then the code to test is fairly simple:
    ` switch (getTags() {

    case "banner1":

    $bannerimage = ;

    break;

    case "banner2":

    $bannerimage =

    break;

    .....

    }`
  • Hello, sbillard! Thanks lot for your help. This is the full working code:

    `

    <?php<br />
    switch (getTags()) {

    case "banner1":

    $bannerimage = 'Banner1';

    break;

    case "banner2":

    $bannerimage = 'Banner2';

    break;

    }

    echo $bannerimage;

    ; ?>

    `

    Now I have another question, I can get the tags from album in image page? I need show the same banner in album page and image page. Assign tags for all images will take a lot of time.

    Thanks again.
  • `$_zp_current_album->getTags()` will do it.
  • Thanks sbillard! Working like a charm
  • Hello - This post almost answers my question... I am new and I need to know where exactly to edit the code - if(getAlbumTitle() === "<the-album-title-you-wand>") { }. There are a lot of files, and I'm not sure which one does the trick.
    Seems that there is no way to do this via the zenphoto administration area, so I assume (??) that it's done from my hosting control panel file manager?

    Any assistance would be appreciated. Thank you.
    Also, why can I not access the "Option", "Theme Options" tab? Shows nothing and says error on page down in the corner. ?? WEIRD
  • acrylian Administrator, Developer
    You would have to edit your theme file if you wish to have a specific banner. You of course need some html and css knowledge for that. It is not possible to do that via the admin options.

    The theme files you would have to alter are index.php, album.php, image.php, search.php and archive.php (if you don't use the last one, you of course don't need to alter it).

    The code for a banner should be right below the <head></head>-section of these files. Where exactly depends on the theme design you want to use.
  • So I can alter the html code directly, right in those files you mentioned? Is it that easy? Right now I'm just using the defalt theme.
    I basically want to add my logo banner jpg file to the top of each page.
    Please clarify that for me so I don't go and do something stupid... ha ha. Thanks
  • acrylian Administrator, Developer
    So I can alter the html code directly, right in those files you mentioned? Is it that easy? Right now I'm just using the defalt theme.
    You would have to change the html code and probably the css files, too. I can't answer if that is easy for. You would need to have some knowledge about html and css of course.
  • I think I can handle this one! Thanks!
  • warlock Member
    Today I upgraded to 1.1.6 and banners hack stop working. Some tags function was changed in 1.1.6?

    This is the code:
    <?php
    switch (getTags()) {
    case "banner1":
    $bannerimage = 'Banner1';
    break;
    case "banner2":
    $bannerimage = 'Banner2';
    break;
    }
    echo $bannerimage;
    ; ?>

    Thanks.
  • acrylian Administrator, Developer
  • Tags are stored as an array now, not a string of comma separated values. You can always refer to the function guide for things like `getTags()`.

    The hack really did not work even before this change if there were more than one tag set since it would return `'tag1,banner1,....`
  • warlock Member
    @acrylian
    @sbillard

    Thanks for reply, I only need one tag to show banners for each image provider, please can you help me with the new code? I'm a little confused. Thanks Again.

    Regards.
  • `$tags = getTags();`
    switch ($tags[0]) {`

    will do.
  • warlock Member
    Thanks mate! Here is the full code, maybe someone will need it:

    <?php
    $tags = getTags();
    switch ($tags[0]) {
    case "BANNER1":
    $bannerimage = 'PROMOTION CODE 1';
    break;
    case "BANNER2":
    $bannerimage = 'PROMOTION CODE 2';
    break;
    }
    echo $bannerimage;
    ; ?>
Sign In or Register to comment.