View Full Version : Drop-Down boxes ~ Separating them from block coding
Loren
07-09-2006, 12:16 PM
Can anyone tell me how to create a drop down box for the drop-down box field created, separately from block coding? It's all together in block coding in the normal suggest-link.tpl and because i have individualized each field, this is the last one that is not complete. :( because i don't know the appropriate individual coding to put that field in a drop-down box. Seems such a shame as it took me ages to type in all the counties of England, Scotland, and Wales! And i can't display them in a drop down box on my suggest-link or edit-link :cry:
Loren
07-11-2006, 09:47 AM
Sweet little reminder Simon or Nick :wink:
Loren
07-17-2006, 12:02 PM
bumpty bump
redeye
07-17-2006, 01:01 PM
:offtopic:Hey! Warned you before about "bumpty bump" ! It'll end in :cry:
Loren
07-17-2006, 03:13 PM
It sure will if i don't get my flipping thread answered :threat: I might just have to hire your services, bone breaker :ph34r:
redeye
07-17-2006, 04:30 PM
The guys in the Chapter work cheap for purdy women :kiss:
Loren
07-18-2006, 07:16 AM
Oh well just my luck then...:(
Hey Guys! What does it take for a girl to get her posts even looked at? Don't even answer that one Red :dance:
C'mon someone must have an idea?
Here is the problem again:
Can anyone tell me how to create a drop down box for the drop-down box field created, separately from block coding? It's all together in block coding in the normal suggest-link.tpl and because i have individualized each field, this is the last one that is not complete. :( because i don't know the appropriate individual coding to put that field in a drop-down box.
Seems such a shame as it took me ages to type in all the counties of England, Scotland, and Wales! And i can't display them in a drop down box on my suggest-link or edit-link :cry:
Vincent Wright
07-18-2006, 11:35 AM
I don't quite understand what you mean by "block coding". Could you explain in more detail what the problem is?
Thanks.
Loren
07-18-2006, 12:33 PM
I don't quite understand what you mean by "block coding". Could you explain in more detail what the problem is?
Thanks.
Okay, block coding is the coding that esyn uses ie {foreach}and everything between{/foreach}
As mine is customed code, ie individually set out, with no {foreach} the drop down box is not shown on my page, because it's an input box. I don't know how to put it in individually, i have tried similar ways to the category box function but that didn't work, i might have missed something.
It's like this at moment
<input type="text" name="county" size="30" value="{$link.county}">
It should be a drop-down box : (
Ok I may understand what your doing or not. (like guys know what women are thinking :)
So in view-link.tpl I removed:
{foreach from=$fields item=field}
bla bla bla
{/foreach}
So that we could: (as Nick posted)
Now you can start to display each field step by step. For example:
<tr>
<td><strong>Link URL:</strong></td><td colspan="2">{$link.url}</td>
</tr>
<tr>
<td><strong>{$lang.description}:</strong></td><td colspan="2" style="border: 1px solid #333;">{$link.description}</td>
</tr>
<tr>
<td><strong>Custom Field:</strong></td><td colspan="2">{$link.custom_field_name}</td>
</tr>
So for:
<tr>
<td><strong>Custom Field:</strong></td><td colspan="2">{$link.custom_field_name}</td>
</tr>
I created a custom field called "Cities" -->see attachment below
Then chose Dropdown List
added item values of:
San Jose
San Diego
San Francisco
Added to language file:
'Cities' => 'Cities',
'San Jose' => 'San Jose',
'San Diego' => 'San Diego',
'San Francisco' => 'San Francisco',
Then added to view-link.tpl
<tr>
<td><strong>Cities:</strong></td><td colspan="2">{$link.Cities}</td>
</tr>
And it worked for the suggest link page and passed the results on to link details page after it was submitted.
Is that what you wanted or am I just completely way off ? :crazy-be:
Loren
07-18-2006, 09:52 PM
Close i think, in the middle of watching a TV program for once, Ghost whisperer very good..anyway, yes i know how to get that part, it's when you individualise them in suggest link.tpl file. I need the code for drop down box to display them in the front end.
Back..from what i can see of the code you posted, are you able now to see a drop-down box in your suggest link page?
t's when you individualise them in suggest link.tpl file. I need the code for drop down box to display them in the front end. if i have not read properly sorry preoccupied hun..back in a while
What do you mean by the front end?
So you've also edited the suggest link.tpl file. Now I see (I think) missed that part. So you want to be able to move say the drop box to the top of the list on suggest as an example? Is that what you mean by "front end"?
Enjoy the show. :)
Loren
07-18-2006, 10:19 PM
Okay lets visualize this..
pic 1 (drop1) is what i have in admin
pic 2 (drop 2) is what i have in my suggest link and edit page, its just a text box, not a drop down
pic 3 (drop 3) is what i want to achieve a drop down box for the above pages in my front end, in order for my counties to display like the categories do..
Thats it i must be lousy at explaining these things sorry petal...:huh:
PS Show had me in tears, little boy had died and didn't know why his mommy couldn't see him..damn haven't had a tear jerker in ages...:cry:apart from when my script don't work...bwaaaah!
Vincent Wright
07-19-2006, 03:02 AM
I seem to have figured it out (probably).
AFAIK you removed the {foreach} loop for custom link field and display each field individually. And now you want to display a combo for Counties.
Well, if that's what you want to achieve I have this suggestion.
Before you display a combo you have to pass two variables to smarty: 1) array of counties 2) a county that is selected by default (e.g. when editor submits a link but there is a problem with some fields, but she selected county and you have to retain the value).
Imagine that you pass an array of counties into $counties variable and selected county into $selected_county variable. You can display combo like that:
<select name="county">
{foreach from=$counties item=county}
{if $county eq $selected_county}
{assign var="selected" value='selected="selected"'}
{else}
{assign var="selected" value=''}
{/if}
<option value="{$county}" {$selected}>{$county}</option>
{/foreach}
</select>
I think the code is self-explanatory.
If I'm wrong and that's not what you are looking for please correct me and we will find another solution.
Loren
07-19-2006, 07:18 AM
Doesn't sound wrong at all Vincent :) Yes i see why you would need both of these, just one thing, will this create the drop-down box too or is this in addition?
I shall see what happens when i apply these attributes anyway i suppose :good: Your a good soul my dear..may your day be filled with much joy and happeness!
Vincent Wright
07-19-2006, 07:52 AM
Thanks Loren.
Loren
07-20-2006, 11:25 AM
Hi Vincent
It didn't work :( Just blank drop box im afraid.
Vincent Wright
07-24-2006, 03:15 AM
Hmm...
What is the page where I can see the blank drop-down box?
Loren
07-24-2006, 06:57 AM
Don't worry about it hun : ) I have given up on it, it works as it does with a text box so, it doesn't really matter, besides you have other things to do. Maybe when the next version comes out it will suit me more ;)
Vincent Wright
07-25-2006, 04:39 AM
If it's ok for you then it's ok for me as well ;)
vBulletin® v3.7.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.