68 Classifieds Forums

68 Classifieds Forums (http://www.68classifieds.com/forums/index.php)
-   v3.1 Questions & Support (http://www.68classifieds.com/forums/forumdisplay.php?f=19)
-   -   Showlistings2.tpl.php help (http://www.68classifieds.com/forums/showthread.php?t=1902)

Lhotch 11-13-2006 09:01 AM

Quote:

Originally Posted by CHRD (Post 10259)
Hi Iv got this code working fine, but Im trying to use it in viewlisting.tpl.php
I tryed to insert it into viewlistings.php but it gave me errors

All the extra fields are already passed to the viewlisting template, so im not sure I understand what your goals are.

CHRD 11-13-2006 10:57 AM

Im calling using {$extra.??.value} but for some reason its only working on a few extra fields,
the extra frields Im trying to use are single line text boxes

Lhotch 11-13-2006 11:52 AM

Quote:

Originally Posted by CHRD (Post 10273)
Im calling using {$extra.??.value} but for some reason its only working on a few extra fields,
the extra frields Im trying to use are single line text boxes

Im still not following you. The default behavior of the viewlisting.php script is to gather all of the extra fields that have been defined in admin and linked to the category in question, then query the data in those fields and pass it along to the viewlisting.tpl.php template file. It does this without any additional code added to the script files.

The viewlisting.php file assigns the extra field data to a multidimensional array called extra and the viewlisting.tpl.php file uses the following smarty template code to iterate over the array of arrays (multidimensional array).

Code:

{foreach from=$extra item=extras}
<tr>
        <td><strong>{$extras.title}:</strong></td>
        <td>
        {if isset($extras.value)}
          {foreach key=key item=item from=$extras.value}
                {$item}<br />
          {/foreach}
        {/if}
        </td>
</tr>
{/foreach}

On each iteration or loop through the $extra array it pulls out the field title (ie $extras.title) and places it in a table data cell and then if their is a value associated with the array title its also displayed in a table data cell via $item.

The number of extra fields passed by default behavior can vary from category to category depending on what extra fields you have defined.

When in doubt, use the smarty debug console to see what fields are passed as I mentioned in my above post.

CHRD 11-13-2006 01:45 PM

sorry I dont know what going on the {debug} is not working for me
I get this:
Warning: Smarty error: [in layout.tpl.php line 1]: syntax error: plugin function smarty_function_debug() not found in /home/fhlinux198/c/cheapholidayrentalsdirect.com/user/htdocs/includes/classes/smarty/plugins/function.debug.php (Smarty_Compiler.class.php, line 798) in /home/fhlinux198/c/cheapholidayrentalsdirect.com/user/htdocs/includes/classes/smarty/Smarty.class.php on line 1095

juven14 11-13-2006 02:37 PM

Try uploading your smarty plugin directory again:

includes/classes/smarty/plugins


All times are GMT -4. The time now is 10:55 PM.

Powered by vBulletin® Version 3.6.3
Copyright ©2000 - 2007, Jelsoft Enterprises Ltd.