Author Topic: Question about language of template. {if...} ... {endif...} form  (Read 5050 times)

0 Members and 1 Guest are viewing this topic.

Offline taru

  • Pre-Newbie
  • Posts: 5
    • View Profile
    • Фото Петербурга. St.-Petersburg photos
In my gallery every detail viewed picture at the same time is a link to the next image in the folder.
So it so easy to view all pictures to the end of the folder simply by clicking to the image.

I have change my details.html:

Code: [Select]
<div align="center">
   {image}
       {if admin_links}<br />
           {admin_links}<br />
       {endif admin_links}<br />
   {lightbox_button}&nbsp;&nbsp;{postcard_button}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{download_button}&nbsp;&nbsp;{download_zip_button}
</div>

to this:

Code: [Select]
<div align="center">

          {if next_image_name}
          <a href="{next_image_url}" alt="{image_name}" title="{image_name}">
          {endif next_image_name}

   {image}
       {if admin_links}<br />
           {admin_links}<br />
       {endif admin_links}<br />
   {lightbox_button}&nbsp;&nbsp;{postcard_button}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{download_button}&nbsp;&nbsp;{download_zip_button}
</div>

When last image in folder is reached - nothing is happen because next_image_name is false. But I want in this case change href to {cat_url}.
How can I use if...else...endif structure here?
Or how can I use logical negation?  Something like this...  {if !next_image_name}  ?
Could someone help me?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Question about language of template. {if...} ... {endif...} form
« Reply #1 on: October 22, 2009, 01:05:22 AM »
you can use {ifno tag}:

Code: (HTML template) [Select]
<div align="center">

  {if next_image_name}
  <a href="{next_image_url}" alt="{image_name}" title="{image_name}">
  {endif next_image_name}

  {ifno next_image_name}
  <a href="{cat_url}" alt="{image_name}" title="{image_name}">
  {endifno next_image_name}

    {image}

   </a>

  {if admin_links}<br />
    {admin_links}<br />
  {endif admin_links}<br />

  {lightbox_button}&nbsp;&nbsp;{postcard_button}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{download_button}&nbsp;&nbsp;{download_zip_button}

</div>
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline taru

  • Pre-Newbie
  • Posts: 5
    • View Profile
    • Фото Петербурга. St.-Petersburg photos
Re: Question about language of template. {if...} ... {endif...} form
« Reply #2 on: October 22, 2009, 08:58:44 AM »
Thanks V@no!

Works fine in 1.7.7!
And one more question. Is there any way to link to the first image in the folder? I think may be better when last image in folder is reached then link to the first image...

I have another site with old version 1.7.1. There don't working {ifno tag}  :( 
« Last Edit: October 22, 2009, 09:33:57 AM by taru »

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Question about language of template. {if...} ... {endif...} form
« Reply #3 on: October 22, 2009, 03:25:31 PM »
Is there any way to link to the first image in the folder? I think may be better when last image in folder is reached then link to the first image...
that would require little .php modification. You can leave template as it is now and in details.php find:
$next_image_id = (isset($image_id_cache[$act_key 1])) ? $image_id_cache[$act_key 1] : 0;

Replace it with:
$next_image_id = (isset($image_id_cache[$act_key 1])) ? $image_id_cache[$act_key 1] : $image_id_cache[0];


I have another site with old version 1.7.1. There don't working {ifno tag}  :( 
[1.7.1] Conditional tags inside other conditional tags + {ifno ...}{endifno ...}
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline taru

  • Pre-Newbie
  • Posts: 5
    • View Profile
    • Фото Петербурга. St.-Petersburg photos
Re: Question about language of template. {if...} ... {endif...} form
« Reply #4 on: October 22, 2009, 08:00:45 PM »
BIG THANKS, V@no!!!  :thumbup: