Include files based on category ID - will this work? - eSyndiCat User Forums
eSyndiCat User Forums esyndicat directory software esyndicat support

Go Back   eSyndiCat User Forums > eSyndiCat Directory Software [FREE] > User interface

User interface Discuss eSyndiCat templates here. All the questions regarding eSyndiCat [FREE] Front end

Reply
 
Thread Tools Display Modes
Old 05-30-2006   #1
90210
 
Join Date: May 2006
Posts: 96
90210 has disabled reputation
Default Include files based on category ID - will this work?

What I'm trying to do is to include file for each category so it would look like this:
for
cat_id = 2
{include file="add/{$category.id}.php"} (thus include add/2.php)
cat_id = 3
{include file="add/{$category.id}.php"} (thus include add/3.php)

and so on...
right now I get : Warning: Smarty error: unable to read resource: "{Array.id" in /home/sites/domain.com/smarty/Smarty.class.php on line 1095
.php"}

what am I doing wrong?
90210 is offline   Reply With Quote
Old 05-30-2006   #2
Greg
Super Moderator
 
Greg's Avatar
 
Join Date: Oct 2005
Location: Phoenix,Arizona (Valley of the Sun)
Posts: 5,356
Greg is a jewel in the roughGreg is a jewel in the roughGreg is a jewel in the roughGreg is a jewel in the rough
Default

If you want to add something to a certain cateory (so it only shows in that category) you would use something such as this:
Code:
{if $category.id == 23}
This will only show in this specific category.
{/if}
So you just add (change) the category id to the above. Depending on the category id#.
__________________
Please don't ask me about script questions or sales issues through "Private Messages". Thanks!
Greg is offline   Reply With Quote
Old 05-31-2006   #3
90210
 
Join Date: May 2006
Posts: 96
90210 has disabled reputation
Default

I can hardcod it for every category but what I would like to do is to have category.id pass in to naming convention of the file I'm trying to include.
so when I do include_file= it will be driven by category id... so it would automaticly name files 1.php or 2.php or 23.php based on category id.
90210 is offline   Reply With Quote
Old 06-01-2006   #4
Nick Collins
Guest
 
Posts: n/a
Default

What exactly these php files will contain? BTW here is an approximate solution:

Code:
{assign var="id" value=$category.id}
{include file=$id}
  Reply With Quote
Old 06-02-2006   #5
90210
 
Join Date: May 2006
Posts: 96
90210 has disabled reputation
Default

Quote:
Originally Posted by Nick Collins
What exactly these php files will contain? BTW here is an approximate solution:

Code:
{assign var="id" value=$category.id}
{include file=$id}

What I wanted to do is “sponsored by” and include banner..
Basically each category can have its sponsor.
90210 is offline   Reply With Quote
Old 06-02-2006   #6
Nick Collins
Guest
 
Posts: n/a
Default

Quote:
What I wanted to do is “sponsored by” and include banner..
Basically each category can have its sponsor.
You can simply use "unique category" functionality in case you have small number of categories. But I can suggest you second and more effective way:

[1]
Create text field "banners" in "dir_categories" table via phpMyAdmin.

[2]
***open admin/edit-category.php***
***find the following code***
Code:
$temp['description'] = addslashes($tmp['description']);
***after add, ***
Code:
$temp['banners'] = addslashes($tmp['banners']);
***find code***
Code:
<tr class="tr">
    <td><strong>Category description:</strong></td>
    <td><textarea name="description" cols="43" rows="8"><?php echo $category['description']; ?></textarea></td>
</tr>
***after add, ***
Code:
<tr>
    <td><strong>Category Banner:</strong></td>
    <td><input type="text" name="banners" size="57" maxlength="150" value="<?php echo $category['banners']; ?>" /></td>
</tr>
***save***

[3]
***open templates/TemplateName/index.tpl***
***find the following code***
Code:
{if $category.description}
    <div class="box" style="border: none;">{$category.description}</div>
{/if}
***after add, ***
Code:
{if $category.banners}
    <div class="box" style="border: none;"><img src="{$category.banners}" /></div>
{/if}
***save***
Note: You can add this code in any other place you want.

[4]
Open your admin CP and browse to category where you would like to add banner. Click "edit" link button and after "Category description" fill in "Category Banner" field with full url of that banner. Save changes.

That's all!
  Reply With Quote
Old 06-04-2006   #7
90210
 
Join Date: May 2006
Posts: 96
90210 has disabled reputation
Default

all I can say is wow.. thanks guys.
90210 is offline   Reply With Quote
Old 06-04-2006   #8
90210
 
Join Date: May 2006
Posts: 96
90210 has disabled reputation
Default

oops, everything works fine Nick, but how do I make banner clickable so by clicking on it would send them to external site?
UPDATE: never mind.. did it the same way and created new field banners_url...
took me 5 minutes.

Last edited by 90210; 06-04-2006 at 05:32 PM.
90210 is offline   Reply With Quote
Old 06-05-2006   #9
Nick Collins
Guest
 
Posts: n/a
Default

You are welcome, 90210!
  Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I include files in the template? echopulse User interface 6 12-13-2005 07:20 AM
Just a curiosity based Question John01 General Chat 1 01-01-1970 01:56 AM
smarty based blog to use with esyndicat Vasily B. Common Questions 9 01-01-1970 01:04 AM
Category dont work seniOr Common Questions 6 01-01-1970 01:02 AM
Does Locked Category include subcategories? Peter Leenders Common Questions 3 01-01-1970 12:43 AM


All times are GMT. The time now is 09:26 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Testimonials | Articles | Support | Documentation | Privacy Policy | License | Affiliates | Contact Us | SEO Resources