Show a certain content only on site's index...

Hi there!



So here I am wanting to show some content only on the index page of my site. It’s not the first time I ran into this problem with “Smarty”, and I actually found a solution when I was using X-Cart, which is:


{if $main eq "catalog" and $current_category.category eq ""}
{include file="somefile.tpl"}
{/if}




I’m sure there’s a way to do it in CS-Cart, I just don’t know which… any suggestions?



Cheers

Its already done for you…



Edit skins/…/customer/welcome.tpl



[SIZE=1]{if $mode ne “catalog”}



basically means, if im the front page !



Either include your template their, or just add code to that template, before the {else}

[/SIZE]

Gosh… I have no idea what can be wrong…


I open the “skins/…/customer/main.tpl”


# Add these lines in red to the code:

```php {include file="side_boxes/logout.tpl"}
{/if}
[COLOR="Red"]{if $mode ne "catalog"}
{include file="customer/social.tpl"}
{/if}[/COLOR]
{if $settings.Modules.news_and_emails == 'Y'} ```

# FTP the file "social.tpl" to the folder "skins/.../customer/"

>>> The file "social.tpl" has only this line of code:

```php
testing
```

# FTP the file "main.tpl" to where it belongs "skins/.../customer/"

# Get an error saying

```php Warning: Smarty error: unable to read resource: "customer/social.tpl" in /home/sites/MYSITE/docs/classes/templater/Smarty.class.php on line 1095 ```

W-h-a-t i-s t-h-e p-r-o-b-l-e-m-o-o-o-o-o-??????

[quote name=‘illusion’]Gosh… I have no idea what can be wrong…




{include file="side_boxes/logout.tpl"}
{/if}
[COLOR=red]{if $mode ne "catalog"}
{include file="customer/social.tpl"}
{/if}[/COLOR]
{if $settings.Modules.news_and_emails == 'Y'}



Get an error saying


```php Warning: Smarty error: unable to read resource: "customer/social.tpl" in /home/sites/MYSITE/docs/classes/templater/Smarty.class.php on line 1095 ```

W-h-a-t i-s t-h-e p-r-o-b-l-e-m-o-o-o-o-o-??????[/quote]

Change to this :-)

```php

{include file="side_boxes/logout.tpl"}
{/if}
{if $mode ne "catalog"}
{include file="social.tpl"}
{/if}
{if $settings.Modules.news_and_emails == 'Y'

```

You dont need to add the path to customer/

SWS, saving my day again…



Thanks a lot pal! :slight_smile:

Sorry if this is a dumb question, but what are you trying to achieve here?

i think hes trying to display something only on the first page that loads. for me this helped because i now only put ‘featured products’ on the first page rather than every page. also i put ad’s on the first page and not on pages like categories. this helped! thanks!

Hey there,



I wanted to show a sidebox only on index page (home). The observation SWS made regarding not using


{if $mode ne "catalog"}
{include file="customer/social.tpl"}
{/if}




but


{if $mode ne "catalog"}
{include file="social.tpl"}
{/if}




instead was very helpful.



However the code that calls the content ONLY on the index page is this:


{if $current_url == "$index_script"}
{include file="social.tpl"}
{/if}




and not this


{if $mode ne "catalog"}
{include file="social.tpl"}
{/if}