View Single Post
  #1  
Old 08-27-2007, 12:27 PM
 
BedTableSofa BedTableSofa is offline
 

Newbie
  
Join Date: Aug 2007
Posts: 2
 

Default Trying to make a new dynamic homepage

Hi all,

I'm new to X-Cart and Smarty but have made some progress in changing an existing site. I have figured out how to update the header and left menu through the correct templates, so I'm getting somewhat familiar with the X-Cart setup.

However, I am stuck right now when trying to update the homepage. Basically I want to remove the Special Offers up there now and from reading these forums it looks like I want to edit the welcome.tpl file. OK, fine. I've made a copy and have been playing with it. However I am not passing variables around correctly it seems. Probably due to my lack of knowledge of how Smarty works.

Basically I am trying to make a new page that will randomly pick an image and display it with a link to each category.

Is there a simple method to just include a php page in the welcome page? I have many years experience writing my own php code and would love to just be able to insert a page which would pick random images and display them in a table with links as needed. Would be nice to be able to get rid of the standard box x-cart seems to want to put everything in too.

I have seen this question asked before on posts from searching, but the answers just seem to direct them to use this or that x-cart feature, not how to just 'do your own thing' within the x-cart framework.

I tried this but it isn't working right.

I made a welcome1.tpl with:

{include file="customer/welcome1.php"}
<TABLE border="0" cellpadding="0" cellspacing="0" align="center">
<TR>
<TD align="center" valign="top"><a href="home.php?cat=38">Leather Sofas<br /><IMG src="/images/categories/
{if $Rand1= eq "1"}
leather-sofa1-200.jpg
{else}
leather-sofa2-200.jpg
{/if}
" border="0" alt="Leather Sofas"></TD>
</TR>
</TABLE>

And a welcome1.php file with:

<?PHP
$Rand = rand (1,2);
?>

But the $Rand variable is not being passed to the template from what I can tell.

I also tried adding in these to the php file with no luck.

$smarty->assign('Rand', $Rand);

and

{assign var='Rand' value=$Rand}

I'm probably just missing one step but I got no clue how to get the variable to be randomly generated by php and used by the template. I've read the entire Smarty manual but I'm still lost.

Perhaps there is already a good post on this? I've searched and read quite a few that offered some insights, but haven't found exactly what I needed yet.

Thanks!

Steve
__________________
Version 4.0.17
Reply With Quote