Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Search found 5 matches
Smarty Forum Index
Author Message
  Topic: File Exists not working
sarderiftekhar

Replies: 8
Views: 1109

PostForum: General   Posted: Fri Oct 12, 2018 2:13 pm   Subject: File Exists not working
Thanks bsmither,

which could give you the same as $sitepath above:
Code:
{if file_exists("`$smarty.server.DOCUMENT_ROOT`/`$asset`/og-image.png")}


This gave the idea, and I solved ...
  Topic: File Exists not working
sarderiftekhar

Replies: 8
Views: 1109

PostForum: General   Posted: Fri Oct 12, 2018 8:20 am   Subject: File Exists not working
HI

The $asset is a variable that changes every time. So can't put a fixed address.

The scenario is there are lot of websites sharing a single base template. And I need to set query that if Image ...
  Topic: File Exists not working
sarderiftekhar

Replies: 8
Views: 1109

PostForum: General   Posted: Thu Oct 11, 2018 11:39 am   Subject: File Exists not working
I even tried like this

{if file_exists("{$asset}/og-image.png")}
<img src="{$asset}/og-image.png" alt="">
{else}
<img src="{URL::to('/ ...
  Topic: File Exists not working
sarderiftekhar

Replies: 8
Views: 1109

PostForum: General   Posted: Thu Oct 11, 2018 11:37 am   Subject: File Exists not working
HI Sorry , put on the wrong code.

{assign var="image" value="{$asset}/og-image.png"}
<h1>{$image}</h1>

{if file_exists($image)}
<img src="{$asse ...
  Topic: File Exists not working
sarderiftekhar

Replies: 8
Views: 1109

PostForum: General   Posted: Wed Oct 10, 2018 3:02 pm   Subject: File Exists not working
HI, I am trying to do this. But its always going to the else condition even though the file exists.

{assign var="image" value="{$asset}/og-image.png"}
<h1>{$image}</h1 ...
 
Page 1 of 1
All times are GMT
Jump to:  


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP