DeanWhitehouse Posted June 1, 2008 Share Posted June 1, 2008 This is my code welcome.php <?php session_start(); require_once('global.php'); $is_id = $_SESSION['userid']; $query = "SELECT * FROM mf_user WHERE ID = '{$is_id}' "; $result = mysql_query($query); $row = mysql_fetch_assoc($result); $image_select = $row['visits']; $smarty = new MySmarty(); $smarty->assign('visits',$image_select); $smarty->assign('title', SITE_TITLE.' :: Cast'); $smarty->assign('site_title', SITE_TITLE); $smarty->assign('base_url', BASE_URL); $smarty->assign('tpl_url', BASE_URL.TPL_URL."default/"); $smarty->assign('hiddenstr', $hiddenstr); //right side data require_once('right_data.php'); //right side data echo $image_select; $smarty->display('welcome1.htm'); ?> and this is welcome.htm <html> <head> <title>.:Asia Underworld:.</title> <meta name="author" CONTENT="tom"> <link href="../../css/main.css" rel="stylesheet" type="text/css"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css"> <!-- {literal} body { background-image: url(../../images/indexbg.jpg);{/literal} } --> </style> {include file="css_js.htm"} </head> <body onLoad="grabit()" onkeypress="screenshotHide(event)"> <div id="dhtmltooltip"></div> <p> </p> <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" class="cat"> {include file="header.htm"} <tr> <td width="120" background="" valign="top"> {include file="left.htm"} </td> <td width="99%" background="" bgcolor="#333333" valign="top"><p> </p> <table width="75%" align="center" cellpadding="0" cellspacing="0" class="cat"> <tr> <td height="20" class="headerbar">- Welcome!</td> </tr> <tr> <td class="sub3"><div align="center"> <p> </p> <p><img src="../../images/test.png" width="500" height="150"></p> <p>{if ($image_select < 2)}<img src="../../images/welcome1.jpg" width="500" height="500">{else}<img src="../../images/welcome2.jpg" width="500" height="500">{/if}</p> <p> </p> </div></td> </tr> </table> <p><br> </p> </td> <td width="120" background="" valign="top"> {include file="right.htm"} </td> </tr> </table> </body> </html> this statement does not seem to work <p>{if ($image_select < 2)}<img src="../../images/welcome1.jpg" width="500" height="500">{else}<img src="../../images/welcome2.jpg" width="500" height="500">{/if}</p> it always shows welcome1.jpg, i have echoed out the variable and it says four. Quote Link to comment https://forums.phpfreaks.com/topic/108286-if-then-else-statement-not-working/ Share on other sites More sharing options...
wmguk Posted June 1, 2008 Share Posted June 1, 2008 might seem daft, but I cant see where you have <?PHP before the if statement? also it is called welcome.htm, surely it would need to be .php to have any dynamic statements working? Quote Link to comment https://forums.phpfreaks.com/topic/108286-if-then-else-statement-not-working/#findComment-555188 Share on other sites More sharing options...
DeanWhitehouse Posted June 1, 2008 Author Share Posted June 1, 2008 nope in smarty you don't put PHP tags in you have to use smarty tags, the problem is basically that the variable is not going into the welcome.htm Quote Link to comment https://forums.phpfreaks.com/topic/108286-if-then-else-statement-not-working/#findComment-555195 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.