|
|
#1 |
|
Moderator
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,390
Rep Power: 41 ![]() ![]() |
I'm hoping someone might be able to give me a solution for this dilemma.
This is in relation to a previous thread: Different template for categories? Thanks given to juven14, Lhotch and especially suzkaw for help with getting my custom templates to work for different categories. Currently, all of my extra fields look great in the custom template, except that the features is currently empty, because the value simply returns "array" Nice fake truck listing My current dilemma is that i can not get the extra field for the features to display in my vehicle template. the issue is that the call to the extra field value is an array (This is because the field is a checkbox field). Snippet from the "debug" capture to display the template with the extra fields. The "Features" field is 10 in the capture of data. PHP Code:
I tried stealing the code from the viewlistings.tpl.php file to attempt to extract it that way: PHP Code:
Any smart php/smarty guru have a suggestion to make this work? Ultimately, I would like to have the array display as $item, $item, $item, until the end of the selected features. Thanks in advance for any help. Sincerely, -Mike
__________________
Mike-N-Tosh v3.1.10 Developer IndianaPC.org - A community website Sandbox v4.0.9, 4.1 Templates, Mods & Docs for sale | My blog with much content for 68 Classifieds. Web Hosting | Web Design & Development | 68 Classifieds Customizations I am not a 68C employee, just a user and try to help out |
|
|
|
|
|
#2 |
|
Moderator
Join Date: Mar 2006
Posts: 4,224
Rep Power: 103 ![]() ![]() |
What your dealing with is actually a multidimensional array or more simply put, a variable that has multiple values and some of those values are actually arrays themselves.
Try something like the following... {foreach name=outer item=extra from=$extras.value} <hr /> {foreach key=key item=item from=$extra} {$key}: {$item}<br /> {/foreach} {/foreach}
__________________
Larry. (Please note: I am not a 68C employee. I am a customer and volunteer who helps with questions where I can and the forums spam free) Set your site apart from the competition with one of my modules...... Google Map Module | You Tube Module | Google Calendar Module | Event Calendar Module 68 Classifieds Important Links Customer Area | Issue Tracker | Knowledge Base | User Manuals |
|
|
|
|
|
#3 | |
|
Moderator
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,390
Rep Power: 41 ![]() ![]() |
Quote:
Thanks for the suggestion, but still no go. It is still blank under the features. This is the actual code that I put in my template to attempt to display the "Features" extra field. PHP Code:
__________________
Mike-N-Tosh v3.1.10 Developer IndianaPC.org - A community website Sandbox v4.0.9, 4.1 Templates, Mods & Docs for sale | My blog with much content for 68 Classifieds. Web Hosting | Web Design & Development | 68 Classifieds Customizations I am not a 68C employee, just a user and try to help out |
|
|
|
|
|
|
#4 |
|
Moderator
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,390
Rep Power: 41 ![]() ![]() |
OK, Now you've done it! You've made me have to resort to this...
Anyone, offer any more help with this???? -Mike
__________________
Mike-N-Tosh v3.1.10 Developer IndianaPC.org - A community website Sandbox v4.0.9, 4.1 Templates, Mods & Docs for sale | My blog with much content for 68 Classifieds. Web Hosting | Web Design & Development | 68 Classifieds Customizations I am not a 68C employee, just a user and try to help out |
|
|
|
|
|
#5 |
|
68 Classifieds Staff
Join Date: Mar 2006
Location: Belmont, NC
Posts: 4,844
Rep Power: 111 ![]() |
Try this although I am not sure if it will work either:
Code:
{foreach from=$extra item=extras}
{if $extras.id == 10}
<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>
{/if}
{/foreach}
__________________
Eric Barnes 68 Classifieds Developer Please do not send me a private message asking for support. Instead use these open forums or our ticket system. Customer Area | Issue Tracker | Documentation | 68C Mods | Submit a Ticket | 68 @ Twitter | My Modules |
|
|
|
|
|
#6 |
|
Moderator
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,390
Rep Power: 41 ![]() ![]() |
Still no go. This suggestion doesn't even show the title. Argh! Thanks for trying though. -Mike
__________________
Mike-N-Tosh v3.1.10 Developer IndianaPC.org - A community website Sandbox v4.0.9, 4.1 Templates, Mods & Docs for sale | My blog with much content for 68 Classifieds. Web Hosting | Web Design & Development | 68 Classifieds Customizations I am not a 68C employee, just a user and try to help out |
|
|
|
|
|
#7 |
|
Senior Member
Join Date: Aug 2006
Location: Georgian Bay, Ontario Canada
Posts: 168
Rep Power: 15 ![]() |
I am having a similar problem where I want to show a small graphic beside each item from the fID 20 in my extras table. I don't want the little graphic beside each of the other items.
Included Options: (fID 20 in SQL table)[*]Option 1[*] Option 2 etc... etc.... I need some kind of "if" logic to show the graphic in the loop only if the item's fID==20. Now, this being said, I think most people who use 68c add their own custom fields (since the power to do so is well designed into 68c). It seems to me that in adding our own fields, 68c should simply allow uses to call and place these items anywhere in their designs using CSS, tables or whatever. This whole idea of multidimensional arrays to store this data makes it hard for a nice design other than vomiting out the whole list line after line on a page. Would this really be hard to change in 68.. maybe in the next release? I understand that the extras can only be called within the scope of the category, but a change to the schema to allow us to make fields, populate them and recall them into our layouts on a field-by-field basis seems to be an oversight... one of the very few I must ad. Something like $extra.category_id.extra_id would be perfect. This name would be created as each extra is created and could then be placed anywhere on the viewlistings or showlistings on a field-by-field basis. Where the field became an array with many selections then we would use the loop to show them. Where the field simply contained a single value or text string we could simply place it. Any ideas or thoughts?
__________________
B. Gordon v.4.0.9 Developer |
|
|
|
|
|
#8 |
|
Moderator
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,390
Rep Power: 41 ![]() ![]() |
I finally got it to work! WooHoo!!!
Here's the code that worked the magic! PHP Code:
__________________
Mike-N-Tosh v3.1.10 Developer IndianaPC.org - A community website Sandbox v4.0.9, 4.1 Templates, Mods & Docs for sale | My blog with much content for 68 Classifieds. Web Hosting | Web Design & Development | 68 Classifieds Customizations I am not a 68C employee, just a user and try to help out |
|
|
|
|
|
#9 | |
|
68 Classifieds Staff
Join Date: Mar 2006
Location: Belmont, NC
Posts: 4,844
Rep Power: 111 ![]() |
Glad you got it Mike.
Now to follow up with bgordon: Quote:
Maybe when things slow down we can revisit this section and see how difficult it would be to pull them out differently but for right now it will stay the way it is.
__________________
Eric Barnes 68 Classifieds Developer Please do not send me a private message asking for support. Instead use these open forums or our ticket system. Customer Area | Issue Tracker | Documentation | 68C Mods | Submit a Ticket | 68 @ Twitter | My Modules |
|
|
|
|
|
|
#10 |
|
Senior Member
Join Date: Aug 2006
Location: Georgian Bay, Ontario Canada
Posts: 168
Rep Power: 15 ![]() |
Ok... I get the array challeng but seem unable to pull the individual values out...
I want to make my own table and be able to show the extras on a cell-by-cell basis where I want. I have fID numbers for all the common extras and am just missing how to call them for individual display. Can you make me a little loop that I can use to call the value from an extra text field value based on the fID? I would then change this and re-use it wherever I wanted to display all my extra information in my new layout. Also, would this little loop need to be modified to show the extras value from a field where the user chose a value from a list? or would the solution be the same with the relevant fID. Thanks... this has been driving me nuts... I can't quite get this to work. BTW: This loop would get used in showlistings and viewlisting templates where I want to make a snazzy layout that shows the extras in a formatted way as opposed to line-after-line. |
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| extra fields in the listing modification | Acpjax | v3.1 Questions & Support | 4 | 11-20-2006 01:20 PM |
| Enabled extra field and pdf file keeps "falling out" of previous listings | sedonagate | v3.1 Questions & Support | 3 | 09-21-2006 08:50 PM |
| Adding an Extra Field that is clickable | sporthorsebreeder | HTML, CSS, and Design Help | 12 | 09-04-2006 02:03 AM |
| Displaying extra field in Search and category listings | Bucketman | v3.0 Questions & Support | 3 | 04-26-2006 09:48 AM |