Author Topic: show diffrent link if file is gif/video etc.  (Read 8858 times)

0 Members and 1 Guest are viewing this topic.

Offline BartAfterDark

  • Hero Member
  • *****
  • Posts: 520
    • View Profile
show diffrent link if file is gif/video etc.
« on: June 19, 2006, 04:40:55 PM »
Hello.

I'm trying to allow the users to download/buy videoes etc. and then get them to there phone. But the service I use does not use the same code for images/animations and videos. So I'm trying to build something where I can sellect diffrent code for vidoes etc.

I've added a new field to 4images_images called image_type and also added
Code: [Select]
$additional_image_fields['image_type'] = array($lang['mms_picture'], "text", 0); to db_field_definitions.php. I was thinking about doing it like this {if image_type} LINK {endif image_type}

I'm not really that good at php/mysql. So I hope someone can guide me a little bit :) (I’m going to publish it here when it is working ;))

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: show diffrent link if file is gif/video etc.
« Reply #1 on: June 20, 2006, 01:15:16 AM »
try this in templates:
Code: [Select]
<?php
if ($this->val_cache['image_type'] == "gif")
{
  //code here.
}
?>

another alternative without any extra fields in the database is add these links directly into media templates. That way you can specify different links in different templates.
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 BartAfterDark

  • Hero Member
  • *****
  • Posts: 520
    • View Profile
Re: show diffrent link if file is gif/video etc.
« Reply #2 on: June 20, 2006, 01:24:05 AM »
I get this
Code: [Select]
Parse error: parse error, unexpected '}' in W:\www\includes\template.php(101) : eval()'d code on line 111 When imagetype matches the one it should

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: show diffrent link if file is gif/video etc.
« Reply #3 on: June 20, 2006, 01:49:19 AM »
what did you add instead of "code here." ? there must be PHP code and not HTML.
If you want use HTML code there, you'll need use this instead:
Code: [Select]
<?php
if ($this->val_cache['image_type'] == "gif")
{
?>

<!-- HTML CODE HERE -->
<?php
}
?>
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 BartAfterDark

  • Hero Member
  • *****
  • Posts: 520
    • View Profile
Re: show diffrent link if file is gif/video etc.
« Reply #4 on: June 20, 2006, 03:47:16 PM »
what did you add instead of "code here." ? there must be PHP code and not HTML.
If you want use HTML code there, you'll need use this instead:
Code: [Select]
<?php
if ($this->val_cache['image_type'] == "gif")
{
?>

<!-- HTML CODE HERE -->
<?php
}
?>
Still no go.

It does not show anything when I tried that. And nothing in the HTML source when I look in that

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: show diffrent link if file is gif/video etc.
« Reply #5 on: June 21, 2006, 01:31:11 AM »
then your condition is wrong, the "gif" was just an example you must change it to whatever value you want to do the check for, I have no clue about your setup.
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 BartAfterDark

  • Hero Member
  • *****
  • Posts: 520
    • View Profile
Re: show diffrent link if file is gif/video etc.
« Reply #6 on: June 21, 2006, 11:27:31 AM »
I did change it to jpg. Because the picture it is showing is indeed jpg.

And about the adding the links directly into the media templates, I tried that some time ago, but {commands} did not work inside of them.

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: show diffrent link if file is gif/video etc.
« Reply #7 on: June 21, 2006, 03:17:41 PM »
1) is word "jpg" stored in the new field in the database?
2) what {command} didnt work?

You've lost me there...
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 BartAfterDark

  • Hero Member
  • *****
  • Posts: 520
    • View Profile
Re: show diffrent link if file is gif/video etc.
« Reply #8 on: June 21, 2006, 05:55:57 PM »
1) V@NO you did it once again. It IS working just me that haven't got the brain of your calibre =) Thank you sooo much

2) I meant commands like this {image_file_name} they did not want to work for me when they where used inside of the media template files