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} Link to comment https://forums.phpfreaks.com/topic/95139-do-not-show-image-when-there-is-no-link-inserted/ 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;"/>'; } Link to comment https://forums.phpfreaks.com/topic/95139-do-not-show-image-when-there-is-no-link-inserted/#findComment-487338 Share on other sites More sharing options...
corbin Posted March 9, 2008 Share Posted March 9, 2008 What templating script are you using? Link to comment https://forums.phpfreaks.com/topic/95139-do-not-show-image-when-there-is-no-link-inserted/#findComment-487340 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} Link to comment https://forums.phpfreaks.com/topic/95139-do-not-show-image-when-there-is-no-link-inserted/#findComment-487345 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;"/>'; } Link to comment https://forums.phpfreaks.com/topic/95139-do-not-show-image-when-there-is-no-link-inserted/#findComment-487348 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 Link to comment https://forums.phpfreaks.com/topic/95139-do-not-show-image-when-there-is-no-link-inserted/#findComment-487350 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.