Could someone post the code I would have to use to create a search box that would look like the searchbox you get now when you go to block manager and pick searchbox?
What I would like to do is take the code and create a new search block using a scriptbox in the block manager.
Thank you,
The code is in the TPortalBlocks.template.php file, which is in your theme directory.
Thanks for the reply.
Ok, I took a look there and found this.
<?php
// TPortal searchblock
function TPortal_searchbox()
{
global $context, $settings, $options, $txt , $scripturl;
echo '
<form accept-charset="', $context['character_set'], '" action="', $scripturl, '?action=search2" method="post" style="padding: 0; text-align: center; margin: 0; margin-bottom: 5px;">
<br /><input type="text" name="search" value="" style="width: 85%;" /><br />
<input type="submit" name="submit" value="', $txt[182], '" style="width: 90%; margin: 4px;" /><br /><span class="smalltext">
<a href="', $scripturl, '?action=search;advanced">', $txt['smf298'], '</a></span>
<input type="hidden" name="advanced" value="0" />
</form>';
}
?>
I copy and paste this into a phpbox and get this error mesage showing up in that box when I view the site.
Parse error: parse error, unexpected '<' in /home/content/a/p/p/appliancejunk/html/forums/Sources/Load.php(1753) : eval()'d code(35) : eval()'d code on line 1
Not as simple as I thought....
did you take off the <?php and ?>
Yeah, I tried that first.
function TPortal_searchbox()
{
global $context, $settings, $options, $txt , $scripturl;
echo '
<form accept-charset="', $context['character_set'], '" action="', $scripturl, '?action=search2" method="post" style="padding: 0; text-align: center; margin: 0; margin-bottom: 5px;">
<br /><input type="text" name="search" value="" style="width: 85%;" /><br />
<input type="submit" name="submit" value="', $txt[182], '" style="width: 90%; margin: 4px;" /><br /><span class="smalltext">
<a href="', $scripturl, '?action=search;advanced">', $txt['smf298'], '</a></span>
<input type="hidden" name="advanced" value="0" />
</form>';
}
and when I do it that way I get this error.
Fatal error: Cannot redeclare tportal_searchbox() (previously declared in /home/content/a/p/p/appliancejunk/html/forums/Sources/Load.php(1753) : eval()'d code:7) in /home/content/a/p/p/appliancejunk/html/forums/Sources/Load.php(1753) : eval()'d code(35) : eval()'d code on line 1
Try this
{
global $context, $settings, $options, $txt , $scripturl;
echo '
<form accept-charset="', $context['character_set'], '" action="', $scripturl, '?action=search2" method="post" style="padding: 0; text-align: center; margin: 0; margin-bottom: 5px;">
<br /><input type="text" name="search" value="" style="width: 85%;" /><br />
<input type="submit" name="submit" value="', $txt[182], '" style="width: 90%; margin: 4px;" /><br /><span class="smalltext">
<a href="', $scripturl, '?action=search;advanced">', $txt['smf298'], '</a></span>
<input type="hidden" name="advanced" value="0" />
</form>';
}
That works, :)
The only difference is that this was removed?
function TPortal_searchbox()
Thanks,
yup thats what I thought was causing the error, but I am not coder but thought it was worth a shot ;)
glad it works
oh I use a php box
thanks again,
:up:
function TPortal_searchbox()
Should have been
function TPortal_searchbox();
Just tried it with the
function TPortal_searchbox();
and with the I get this error message.
Parse error: parse error, unexpected ';', expecting '{' in /home/content/a/p/p/appliancejunk/html/forums/Sources/Load.php(1753) : eval()'d code(35) : eval()'d code on line 1
What you want is:
global $context, $settings, $options, $txt , $scripturl;
echo '
<form accept-charset="', $context['character_set'], '" action="', $scripturl, '?action=search2" method="post" style="padding: 0; text-align: center; margin: 0; margin-bottom: 5px;">
<br /><input type="text" name="search" value="" style="width: 85%;" /><br />
<input type="submit" name="submit" value="', $txt[182], '" style="width: 90%; margin: 4px;" /><br /><span class="smalltext">
<a href="', $scripturl, '?action=search;advanced">', $txt['smf298'], '</a></span>
<input type="hidden" name="advanced" value="0" />
</form>';
Sorry. I should have posted this in the first place. I misunderstood your level of experience.