Go Back   PHP Link Directory Forum > PHP Link Directory (phpLD) > Mods and contribution Discussion

Mods and contribution Discussion This forum is only for discussion of modding phpLD. For specific mod releases, please see the appropriate forum.

Closed Thread
 
Thread Tools Display Modes
Old 01-18-2006   #1
Neticus
Supporter
 
Neticus's Avatar
 
Join Date: Dec 2005
Posts: 487
Default Keep search term in search field after submit

Just basic code to help make user experience easier.

When a search term is searched it disappears from the search field after submit. To keep search term in the search field use this:


In top_bar.tpl place this:

Code:
{php}
		if ( isset( $_GET['q'] ) ) {
			$sQ = $_GET['q'];
		} else {
			$sQ = '';
		}
{/php}

Find:

Code:
{* Search form *}
<form action="{$smarty.const.DOC_ROOT}/index.php" method="get">
<input type="text" name="q" size="20" class="text" /> <input type="submit" value="{l}Search{/l}" class="btn"/>
</form>
</span>

Place this code after class="text" :

Code:
value="{$smarty.get.q|default:""}"
Now search term will stay in the search field after submit, allowing user to modify terms without re-typing the full sentence again.

And thats all folks :)


- Neticus

Edited to give post appropriate title no code has been changed.
Neticus is offline  
Old 01-21-2006   #2
vegabond
 
vegabond's Avatar
 
Join Date: Aug 2005
Location: Dhaka, Bangladesh
Posts: 854
Default Thanks

Thanks for this good mod
__________________
Web Mustang ~ Allthelink ~ OS Designer - phpLD Templates ~ Templates Pedia
vegabond is offline  
Old 01-21-2006   #3
Neticus
Supporter
 
Neticus's Avatar
 
Join Date: Dec 2005
Posts: 487
Default

No probs.
Neticus is offline  
Old 02-24-2006   #4
igotdreams
 
Join Date: Feb 2006
Location: Orlando, Florida
Posts: 12
Default

In 3.0.2 it looks like this;

Code:
<input type="text" name="q" size="45" class="input" />
Change to;

Code:
<input type="text" name="q" size="45" class="input" value="{if !empty($q)}{$q}{/if}" />
igotdreams is offline  
Old 02-24-2006   #5
Boby
Supporter
Moderator
 
Boby's Avatar
 
Join Date: Dec 2005
Location: Cluj-Napoca/Sighisoara (Romania)
Posts: 4,468
Default

Why not use a variable that is allready set?

Code:
<input type="text" name="q" size="20" class="text" value="{if !empty($q)}{$q}{/if}" />
Boby
__________________
wanna say thank you?
  • My phpLD Mods
  • I am *not* a phpLD staff member, so please do *not* ask me to grant permissions, sales stuff, for access to the private supporter forums or phpLD 3.0+ download area.
  • Before you report your problems, make sure it happens with the *default* package and not your highly modified code. Don't forget to use the search feature and do not *bump* threads to soon (allow at least 24h).
Boby is offline  
Old 02-24-2006   #6
Neticus
Supporter
 
Neticus's Avatar
 
Join Date: Dec 2005
Posts: 487
Default

Quote:
Originally Posted by Boby
Why not use a variable that is allready set?

Code:
<input type="text" name="q" size="20" class="text" value="{if !empty($q)}{$q}{/if}" />
Boby
Ahh I see, in your demonstration there is no need for any other code but to put

Code:
value="{if !empty($q)}{$q}{/if}"
in the appropriate place.

Less code same effect. Much better

Thanks
Net.
Neticus is offline  
Old 04-13-2006   #7
bobby9101
 
bobby9101's Avatar
 
Join Date: Sep 2005
Posts: 678
Default

Quote:
Originally Posted by Boby
Why not use a variable that is allready set?

Code:
<input type="text" name="q" size="20" class="text" value="{if !empty($q)}{$q}{/if}" />
Boby
that doesn't work for me :-(
__________________
Please check your sig links
bobby9101 is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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


All times are GMT +1. The time now is 01:06 PM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.