Welcome, Guest. Please login or register.
Did you miss your activation email?
May 27, 2012, 06:05:48 AM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155555 Posts in 21715 Topics by 7737 Members
Latest Member: gx-world
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Showing search (hardcoded) only on 5 pages  (Read 714 times)
Bramus
Forum Team
*****
Offline Offline

Posts: 601


WWW
« on: January 11, 2008, 06:05:50 PM »

Is it possible to manipulate the index.php of a template that way, that i make some kind of " if  " statement with page_id's that it will show the search function only on the page_id's that i enter there?

So that a search function only will show up on page_id 4, 5, 6. This because i'm using the new search engine from thorn and i have a search box for the whole site except 5 pages. Now i have a new box in the template and when you go to for example page_id 4 (Machinery) it will show a new search box where you can search for new and old machinery (the searching is handled by the new search box) So i only need some help in how can i show some piece of code in 5 page_id's only?

This HAS to be done in the index.php as i dont want to waste any space on the page content. I reserved already some space for the search box that has to show up while designing editing a template.

I hope you know what i mean and can help me. Thanks for the time and help!
Logged

BRAMUS Internet Services
doc
Guest
« Reply #1 on: January 11, 2008, 11:06:19 PM »

Hi,

yes all of this is doable, but you need some basic knowledge of PHP. Have a look at:
http://de.php.net/manual/en/

Simply type the function, or whatever you want into the search for field and you can dicsover what PHP can do for you by yourself.

Regards Christian
Logged
thorn

Offline Offline

Posts: 980


WWW
« Reply #2 on: January 12, 2008, 09:34:55 AM »

Hello,

giving some hints:

- The actual page_id is found in constant PAGE_ID.
- You can define an array with page_ids on which the search-form should be visible: $ptsso("4","5","6")
- Now use function in_array() to check if PAGE_ID is in $ptsso

Hope that helps.

thorn.
Logged

Bramus
Forum Team
*****
Offline Offline

Posts: 601


WWW
« Reply #3 on: January 12, 2008, 11:13:16 AM »

thx for the help, i managed to do it with an IF statement and then the page_id's.
Logged

BRAMUS Internet Services
DGEC

Offline Offline

Posts: 386


WWW
« Reply #4 on: January 15, 2008, 04:49:33 PM »

If I understand correctly, you want to have the search box on some pages and not on others.

If this is a permanent situation, the easiest way for people without much coding experience (or if you're turning this over to content creators for page creation and editing) would be to have 2 templates - one with search and one without (just delete the entire search form from index.php).

On any page where you want to use the version that is NOT the default template, just go to the Page Settings and pick the other template.
Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!