werushka Posted March 9, 2008 Share Posted March 9, 2008 In my .tpl file there is a code as it posted below <img src="{$link_field1}" height="100px" alt="Resim Yok" style="float:left; padding-right:10px;padding-top:0px;"/> What this does is that when the user inserts a image url when making a post then the image is showed on the page, but if the user does not enter a image url then the image location has "X" no image icon. I would like to need help with the coding that when there is No image url submitted then the image location should be empty instead of "x" I should write a code smilar to this {if $link_field1 eq notnull} <img src="{$link_field1}" height="100px" alt="Resim Yok" style="float:left; padding-right:10px;padding-top:0px;"/> {else} leave it empty {/if} Quote Link to comment Share on other sites More sharing options...
deansatch Posted March 9, 2008 Share Posted March 9, 2008 did you not just answer your own question? if (!$link_field1){ echo'<img src="'.$link_field1.'" height="100px" alt="Resim Yok" style="float:left; padding-right:10px;padding-top:0px;"/>'; } Quote Link to comment Share on other sites More sharing options...
corbin Posted March 9, 2008 Share Posted March 9, 2008 What templating script are you using? Quote Link to comment Share on other sites More sharing options...
werushka Posted March 9, 2008 Author Share Posted March 9, 2008 Thanks for your replies it is not a script it is just Pligg CMS. In the mean time the syntax gives error (noting shows on the page) Example of how php is used in template file is as follows this is just an example {if $use_title_as_link eq true} {if $url_short neq "http://" && $url_short neq "://"} <a href="{$url}" {if $open_in_new_window eq true} target="_blank"{/if}>{$title_short}</a> {else} <a href="{$story_url}">{$title_short}</a> {/if} Quote Link to comment Share on other sites More sharing options...
deansatch Posted March 9, 2008 Share Posted March 9, 2008 did you not just answer your own question? if (!$link_field1){ echo'<img src="'.$link_field1.'" height="100px" alt="Resim Yok" style="float:left; padding-right:10px;padding-top:0px;"/>'; } I meant this sorry if ($link_field1 !=''){ echo'<img src="'.$link_field1.'" height="100px" alt="Resim Yok" style="float:left; padding-right:10px;padding-top:0px;"/>'; } Quote Link to comment Share on other sites More sharing options...
werushka Posted March 9, 2008 Author Share Posted March 9, 2008 Thanks for your reply actually i did this and worked {if $link_field1} <img src="{$link_field1}" height="100px" alt="Resim Yok" style="float:left; padding-right:10px;padding-top:0px;"/> {else} {/if} Thank you very much for your help Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.