Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2007-01-13 05:29:34
- progre55
- Member
- Registered: 2006-05-02
- Posts: 668
Displaying Output from a PHP Function
I have been working hard to design an advanced search capability on my current project using categories. I am attemtping to give the site visitor the capability of selecting multiple categories and have the articles relating to those categories returned. I think I am close, but here is where I stand:
<!— Advanced Search —>
<h1 class=“nav”>Advanced Search</h1>
<form id=“advanced_search” action=“http://<txp:php> print $GLOBALS[‘siteurl’].’/’.$GLOBALS[‘s’]; </txp:php>/” method=“get”>
<txp:php>
$type_of_properties = safe_rows(“name,title”, “txp_category”, “parent=‘WEEK’ order by name asc”);
if (!empty($type_of_properties)) { for ($i=0; $i<neat_count($type_of_properties); $i++) { $selected = ($type_of_properties[$i][‘name’] == $_GET[‘WEEK’]) ? ‘selected=“selected”’ : ‘’; $type = ‘ <option value=”’.$type_of_properties[$i][‘name’].’” ‘.$selected.’>’.$type_of_properties[$i][‘title’].’</option>’.”\n”; print $type; } } </txp:php></select></p><input type=“submit” id=“submit” value=“Search” /> </form><!— advanced search —>@
The above code does generate a list of the days of the week which are part of the parent “WEEK”.
It also does allow me to select multiple items.
But when I hit search this is what is returned:
http://sitename/section/?type=1Monday&type=2Tuesday&type=3Wednesday
But nothing appears on the page. I am guessing that I need to adjust the action, but maybe it is something else
Any and all assistance would be greatly appreciated
Any and all guidance would be appreciated since I do believe I am actually close to solving this problem. But then again, I have thought that before.
progre55
Offline
#2 2007-01-13 06:56:01
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Displaying Output from a PHP Function
It wouldn’t because you haven’t told it to display anything (only how to build the form) and Textpattern doesn’t understand the variables you’re passing either.
You can replace this:
http://<txp:php> print $GLOBALS['siteurl'].'/'.$GLOBALS['s']; </txp:php>/
with this, though (just ‘cuz it’s much neater, so easier to read later):
<txp:site_url /><txp:section />
Last edited by Mary (2007-01-13 06:56:13)
Offline
Pages: 1