4images Forum & Community

4images Issues / Ausgaben => Installation, Update & Configuration => Topic started by: Chris on September 28, 2002, 05:43:21 PM

Title: Hide download button based on permissions using templates?
Post by: Chris on September 28, 2002, 05:43:21 PM
I know that if the user doesn't have permission to download, a grayed out download button is displayed.  I would like to conditionally remove the download button if the user doesn't have permission as this would allow me to also remove a table cell that holds it.

I also know that we can use {if XXsomeVariable} and {endif XXsomeVariable} to do this with database elements and I do this for some things.

Is there any way to do this for the download button?
Title: Hide download button based on permissions using templates?
Post by: Jan on September 28, 2002, 06:15:11 PM
Easiest way is to replace the images download_off.gif with a white or transparent gif.

Jan
Title: Yep
Post by: Chris on September 28, 2002, 07:42:44 PM
Yeah I know.  That's what I'm already doing.  I just wanted to know if it was possible to do it directly in the templates.
Title: Hide download button based on permissions using templates?
Post by: Jan on September 29, 2002, 10:15:18 AM
If you are using version 1.7, try:
Code: [Select]
{if allow_download}
  {download_button}
{endif allow_download}

Greets Jan
Title: Thanks
Post by: Chris on September 29, 2002, 03:55:15 PM
Thanks Jan.  I'm using 1.7 and your suggestion comes close to doing what I need.  In my details template I have:
Code: [Select]

{if allow_download}
<td width="70" height="20" align="center">{download_button}</td>
{endif allow_download}


But this produces html output of:
Code: [Select]

<td width="70" height="20" align="center"></td>


Usually in the templates if-endif also excludes the html.  I guess this is only true for database fields as this is what can be reproduced with
Code: [Select]
{if image_description}
Title: Hide download button based on permissions using templates?
Post by: Jan on September 29, 2002, 04:07:24 PM
Strange, this should work like you want it. All html-code should be removed between the if-endif tags. I tested it, for me it works correctly.

Jan
Title: Of course
Post by: Chris on September 29, 2002, 04:23:47 PM
Duh!  My mistake.  I was looking in the wrong place.  It works!

Question:  Is there any support for "else"?  Something like the following?
Code: [Select]
{if allow_download}
{else}
{endif allow_download}
Title: Hide download button based on permissions using templates?
Post by: Jan on September 29, 2002, 04:32:05 PM
No, sorry.

Jan