TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,973
  • Latest: NonStop
Stats
  • Total Posts: 196,240
  • Total Topics: 21,353
  • Online today: 722
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 208
  • Total: 208

Looking to customize a searchbox block

Started by ApplianceJunk, January 31, 2008, 03:23:52 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ApplianceJunk

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,

JPDeni

The code is in the TPortalBlocks.template.php file, which is in your theme directory.

ApplianceJunk

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....


Lesmond


ApplianceJunk

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

Lesmond

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>';

}

ApplianceJunk

That works, :)

The only difference is that this was removed?

function TPortal_searchbox()

Thanks,

Lesmond

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

ApplianceJunk


G6Cad

function TPortal_searchbox()

Should have been

function TPortal_searchbox();


This website is proudly hosted on Crocweb Cloud Website Hosting.