13, February 2012

If Exist in a CMS Environment? - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  Miscellaneous Languages
Topic: If Exist in a CMS Environment?
« previous next »
Pages: [1] Print
Instabuck - The easy way to sell digital products online

Author Topic: If Exist in a CMS Environment?  (Read 1604 times)
Bill Gates is my home boy
*****
Gender: Female
Posts: 710
4449 credits
Members referred : 2



« on: May 08, 2008, 06:04:10 pm »

Not sure if this is a Smarty issue or a PHP issue so I put my question here. Anyway...

I've taken one of my directories and changed scripts and redid the layout. One of the new options in the script is to showcase 5 new and 5 random listings. I've changed the plugin to show only one of each of these. I've also changed it to show the picture associated with the listing. The problem is that those listings that I am adding myself do not have a picture ( screenshots as well as other images are copyrightable and I only want to use pictures with the permission of the site owners and it is also a way to slightly reward the folks who come to me vs the ones I seek out myself.)

It's fairly easy to figure out the record number of each listing so I've named the picture files xxx.jpg where xxx is the record number.

One of the programmers for the script has created this elaborate function and has tried twice now to get this to work. The function does not appear to be working right and I keep thinking that the programmer is doing something like the Hello program joke that Samiotis posted.

Any ideas or suggestions? It just seems like this should be something that could be done in a line or two of code rather than creating external functions.

If xxx.jpg exist then display
else no display
/if

Is it really as complicated as this programmer is making it? I'm beginning to wonder if the best thing to do at this point is to create a 1px jpg for the listings without pictures and use that to have an actual picture to display.

www.yourmessageconsultant.com, providing online content and printed marketing materials.
www.helpforwebbeginners.com, Tutorials and how to's for new  webmasters.
www.CraftyTips.com, a unique Arts & Crafts Directory
www.nocans.com - Pet Food Recipe Site
www.petsiteguides.com - A New Pet Directory

Last blog : Spring Cleaning at Crafty Tips
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5778
46265 credits
Members referred : 3



« Reply #1 on: May 08, 2008, 10:48:25 pm »

This is easy to accomplished. Use a code like this :

 
if ( file_exists('path/to/' $filename) ){
 
//show the image here
}
?>

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Bill Gates is my home boy
*****
Gender: Female
Posts: 710
4449 credits
Members referred : 2



« Reply #2 on: May 09, 2008, 12:36:50 am »

Thank you for the code Nikolas. It is giving me an error which I suspect is because I am not using it properly.

[blockquote]

if ( file_exists('http://www.petsiteguides.com/site-thumbs/{$new_listing.id}.jpg) ){
 <img src="http://www.petsiteguides.com/site-thumbs/{$new_listing.id}.jpg" alt="{$new_listing.title|replace:"&":"and"}" />
}

[/blockquote]

$new_listing.id holds the record number

Where did I go wrong?

www.yourmessageconsultant.com, providing online content and printed marketing materials.
www.helpforwebbeginners.com, Tutorials and how to's for new  webmasters.
www.CraftyTips.com, a unique Arts & Crafts Directory
www.nocans.com - Pet Food Recipe Site
www.petsiteguides.com - A New Pet Directory

Last blog : Spring Cleaning at Crafty Tips
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5778
46265 credits
Members referred : 3



« Reply #3 on: May 09, 2008, 02:09:08 pm »

You are messing php code with smarty code. The fragment I wrote is in php. So you need to use something like :

{php}
code fragment
{/php}

In this fragment, variables should be used as php variables. So instead of {$new_listing.id} you should probably use $new_listing->id

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
I crack Photoshop!
*
Posts: 3
18 credits
Members referred : 0


well as other images are copyrightable
« Reply #4 on: Nov 10, 2008, 05:49:22 pm »

One of the new options in the script is to showcase 5 new and 5 random listings. I've changed the plugin to show only one of each of these. I've also changed it to show the picture associated with the listing. The problem is that those listings that I am adding myself do not have a picture ( screenshots as well as other images are copyrightable and I only want to use pictures with the permission of the site owners and it is also a way to slightly reward the folks who come to me vs the ones I seek out myself.
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=7731
Tags : if exist web programming Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  Miscellaneous Languages
Topic: If Exist in a CMS Environment?
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Feb 13, 2012, 06:33:28 pm





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!






Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2012 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.