The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
IF CONDITION problem
I have 2 folders for images. The 1st folder is for admin upload. And 2nd folder is for users. I would like to make a condition for first check the 1st folder, if not available then check 2nd folder and if not available there too then display the noimage file.
Something like this : Code:
<if condition="image_ID.jpg"> <img src="1stfolder/image_ID.jpg"> <else /> <img src="2ndfolder/image_ID.jpg"> <else /> <img src="noimage.jpg"> </if> Any idea about how to do that ? Thanks in advance... |
#2
|
|||
|
|||
I don't think there's any way to do that in a template conditional. You'd have to use code in a plugin, or maybe there's some way to insert javascript to make the browser load alternate images if one's not available.
|
#3
|
|||
|
|||
thank you kh99.
actually what i wrote above was just an example. the thing i would like to do is little bit different. but main idea is like above mentioned example. let me be more clear with what i would like to do. Code:
<if condition="$castinfo[photo] != ''"> <a href='info/person.php?id=$castinfo[id]'><img src="./cache/person/$castinfo[id].jpg" alt="$castinfo[name]" /></a> <else /> <a href=''info/person.php?id=$castinfo[id]'><img src="./cache/person/noimage.jpg" alt="$castinfo[name]" /></a></if> but since i do not want to display "noimage.jpg" on pages that much, i upload the pictures myself. and due to script do the logging, it's not working if i upload the picture to the "person" folder (thats where the files are stored). so i've created a "custom" folder under "person" folder. before displaying the "noimage.jpg" file if file do not exists, i would like to make it check the "person/custom" folder too... |
#4
|
|||
|
|||
...
|
#5
|
|||
|
|||
thanks again kh99.
let me see if i will find a solution or not... |
#6
|
|||
|
|||
oops (admin, you can remove this maybe?)
|
#7
|
|||
|
|||
Code:
$postbit_movieinfo_cast = ''; $i = 1; foreach ($movieinfo['cast'] AS $castinfo) { $filename = './cache/person/' . $castinfo['id'] . '.jpg'; if ($castinfo['photo'] AND $castinfo['id'] AND !file_exists($filename)) { require_once(DIR . '/includes/class_image.php'); $content = file_get_contents($castinfo['photo']); $handler = @fopen($filename, 'w'); @fwrite($handler, $content); @fclose($handler); $thmbnail_class = vB_Image::fetch_library($vbulletin); $thumbnail = $thmbnail_class->fetch_thumbnail($castinfo['id'] . '.jpg', $filename, 100, 140); unlink($filename); $filename = './cache/cast/' . $castinfo['id'] . '.jpg'; $handler = @fopen($filename, 'w'); @fwrite($handler, $thumbnail['filedata']); @fclose($handler); } But i did something much easier. (maybe we can not call it a solution) Instead of noimage.jpg file, i forced <else /> condition to show the image in "person/custom" folder... If there is no image in that folder too, its not showing anything. So when i see that kind of empty columns (no picture in the table), i upload the image manually. And its showing... I know its not a proper way to display the image but since am not a coder, thats the most practical/easiest way for me and once again i would like to thank you for your kind answers and help kh99 |
#8
|
|||
|
|||
OK - sorry I deleted my answer above, I misunderstood and thought you wanted to see if anyone else knew of an answer.
(nvm - that code was wrong...need to understnd it better). |
#9
|
|||
|
|||
I did your advise but nothing changed... Thank you.
If you would like to see the live example of what i would like to do here it is : http://www.dwshare.com/f831/gran-tor...4858?langid=14 Since the website is still under construction, some posts/threads are still not showing due to the data loss during the database move... |
#10
|
|||
|
|||
Looks nice.
Sorry, I keep posting before thinking. It would probably be necessary to see more of the code to be able to post a solution. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|