Jump to content

how to link


starhawk85

Recommended Posts

okay i may be completely in the wrong area, need some help if anyone could.

 

My code

<option class="selectCategory" value="{$searchCategory.categoryId}" {if $searchCategory.categoryId==$categoryId}selected="selected"{/if}>{$searchCategory.name}</option>

 

I want to make this into a regular old Link... such as click here type thing.

 

thanks in advance.

 

 

Link to comment
Share on other sites

I am unsure how to make this into a link, without the dropdown.

 

i want to get rid of the select options and just have a plain link. but still need if statement to show or hide

 

here is the whole code

<select name="categoryId" id="searchEngineCategoryId">
<option value="0">{'extraFieldSearch_all_categories'|lang}</option>
{foreach from=$searchCategories value=searchCategory}
<option class="selectCategory" value="{$searchCategory.categoryId}" {if $searchCategory.categoryId==$categoryId}selected="selected"{/if}>{$searchCategory.name}</option>
{foreach from=$searchCategory.subcategories value=subcategory}
<option class="selectSubcategory" value="{$subcategory.categoryId}" {if $subcategory.categoryId == $categoryId}selected="selected"{/if}>        {$subcategory.name}</option>
{/foreach}
<option class="space" value=""></option>
{/foreach}
</select>

 

 

Link to comment
Share on other sites

Well, let's explore your code then, shall we?

 

You have a few things defined in your <option>s that are going to be usable.  What you need to determine is which parts of those are going to be useful to build your links.  What are your URI paths?

 

To make:

example.com/search?category=XXX&term=XXX

 

Break down your code

<option class="selectCategory" value="{$searchCategory.categoryId}" {if $searchCategory.categoryId==$categoryId}selected="selected"{/if}>{$searchCategory.name}</option>

 

and plug in the pieces

<a href=example.com/search?category=<? something here; ?>&term=<? something here; ?>

Link to comment
Share on other sites

This is your last chance with me, and I'll give you every opportunity to help me help you.

 

A: What values are you getting from the script to put into the current <option> ?

B: Where does the link anchor to?

C:  What is the current HTML output?

Link to comment
Share on other sites

it is entirely one page, code is as follows.

 

{if empty($edit)}
<div class="search_cat_place">
<span class="text_search">{'extraFieldSearch_category'|lang}</span>
<select name="categoryId" id="searchEngineCategoryId">
<option value="0">{'extraFieldSearch_all_categories'|lang}</option>
{foreach from=$searchCategories value=searchCategory}
<option class="selectCategory" value="{$searchCategory.categoryId}" {if $searchCategory.categoryId==$categoryId}selected="selected"{/if}>{$searchCategory.name}</option>
{foreach from=$searchCategory.subcategories value=subcategory}
<option class="selectSubcategory" value="{$subcategory.categoryId}" {if $subcategory.categoryId == $categoryId}selected="selected"{/if}>        {$subcategory.name}</option>
{/foreach}
<option class="space" value=""></option>
{/foreach}
</select>
<a href=class="selectCategory" value="{$searchCategory.categoryId}" {if $searchCategory.categoryId==$categoryId}selected="selected"{/if}> Advanced search</a>
</div>

<div class="din_search_engine"> 
{/if}

    
{if !empty($extraFields)}
<style>
{literal}
.searchModule
{
padding: 0px 5px;
width: 200px;
line-height: 1.8;
position: absolute;
}

{/literal}
</style>
{if empty($edit)}<div style="position:relative">{/if}


{foreach from=$extraFields value=extraField}

{if !empty($searchEngineSettings.fields[$extraField.fieldId])}
{assign var="fieldSetting" value=$searchEngineSettings.fields[$extraField.fieldId]}
{else}
{assign var="fieldSetting" value=""}
{/if}

{if !empty($edit) || !empty($fieldSetting.display)}

<div class="searchModule" fieldId="{$extraField.fieldId}" style="{if $fieldSetting}left: {$fieldSetting.left}px; top: {$fieldSetting.top}px; width: {$fieldSetting.width}px; height: {$fieldSetting.height}px;{/if}{if empty($fieldSetting) || empty($fieldSetting.display)}display:none;{/if}">
<span class="text_search">{$extraField.name}</span>
<div>
{assign var="fieldName" value="extraField[$extraField.fieldId]"}
{if $extraField.type == "checkbox"} 
{assign var="fieldName" value=$fieldName|cat:'[]'}
{/if}
{switch from=$extraField.type}
{case value="textarea"}
<input type="text" name="{$fieldName}"/>
{case value="text"}
<input type="text" name="{$fieldName}"/>
{case value="select"}
<select name="{$fieldName}">
<option value="">{'extraFieldSearch_select_option'|lang}</option>
{foreach from=$extraField.options value=option}
<option value="{$option.value}">{$option.label}</option>
{/foreach}
</select>
{case value="radio"}
{foreach from=$extraField.options value=option}
<input type="radio" name="{$fieldName}" value="{$option.value}"/> {$option.label}
{/foreach}
{case value="checkbox"}
{foreach from=$extraField.options value=option name=loop}
<span style="width:180px;display:block;float:left"><input type="checkbox" name="{$fieldName}" value="{$option.value}"/> {$option.label}</span>

{/foreach}
{case value="range"}
{'extraFieldSearch_from'|lang} <input type="text" name="{$fieldName}[from]" size="5"/>  
{'extraFieldSearch_to'|lang} <input type="text" name="{$fieldName}[to]" size="5"/>
{case}
{/switch}
</div>
<div style="clear:both"></div>
</div>
{/if}
{/foreach}
{/if}
{if empty($edit)}</div>{/if}

 

as you can see the linking is simply all on the same file and or page.

 

this is where everything that would pertain to linking happens, for this option selection.

Link to comment
Share on other sites

I dont see how it is so very hard for you guys to understand that all i am lookng to do is take the options list and make it into a link there is simply one option.

 

not sure how im confusing you.

 

 

 

The problem is you had not given us what we need to help you until your last post.  Now, we are able to tell you that your anchor tag is incorrectly created.  You need to correctly create the HTML anchor element. Give this a read.  http://www.tizag.com/htmlT/links.php

Link to comment
Share on other sites

I dont see how it is so very hard for you guys to understand that all i am lookng to do is take the options list and make it into a link there is simply one option.

 

not sure how im confusing you.

 

 

 

Really? You didn't post PHP code, and you didn't post html markup. You posted a small amount of crap from an unspecified, templated mess and expect everyone to know what the hell it is, what it does, how it's rendered, what is actually in the form elements and how it gets processed when submitted. Then you were utterly shocked when nobody could tell you what you wanted to know without further information? I don't see what's so hard for you to understand about how to effectively ask a question in a manner such that others have enough information to answer it appropriately without having to pry the necessary details out of you.

Link to comment
Share on other sites

so after everything this is the closest thing that works

 

<a class="selectCategory" value="{$searchCategory.categoryId}" {if $searchCategory.categoryId==$categoryId}selected="selected"{/if}>{$searchCategory.name}</a>

 

only problem is currently HA HA HA its not clickable but it does hover. The alternate is

 

<a href="#" class="selectCategory" value="{$searchCategory.categoryId}" {if $searchCategory.categoryId==$categoryId}selected="selected"{/if}>{$searchCategory.name}</a>

 

these seem to be the only things that seem to be close enough to work...

 

I am still attemting to figure this out, PS Checked out the website. great information and learned a few things i did not know, I dont think this would apply to me but i could be mistaken, if so inform me as to how i could implement  this to work for my self. I will keep updated on my progress. If any further ideas or if a solution might just be found please let me know :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.