iframe search bar

Download plugins, language packs and stuff.

iframe search bar

Postby scottdallas » Sat May 05, 2007 4:36 pm

This is how you put an iframe search bar anywhere you want on your site:



From the .zip file:

1) Copy search.php to / (root directory of cutenews.ru install)

2) Copy show_searchresults.php to / (root directory of cutenews.ru install)

3) Copy search.css to /skins (root directory of cutenews.ru install)



Changing search fonts using search.css:

1) Open search.css and change the font properties.

- - 'fontyfont' is formatting for the words 'Search for:'

- - 'fontyfont-search' is formatting for text in search box.

- - 'fontyfont-dropdown' is formatting for text in both drop downs.



--------

Note: You'll also see this at the top of skins/search.css



body {

background-color: transparent;

}



This sets the background of the iframe transparent so no matter where you place this search bar iframe on your site it will match the background behind it.. like the background of a table or cell that you've previously chosen in your layout. This makes it easier to design with. I've tested it with IE and FF.

--------



How to display search bar in your site:

1) Use the code below on your site wherever you'd like to show the search bar.



<iframe name="searchbar" src="http://www.YOURSITE.com/PATH-TO-CUTENEWS/search.php" allowtransparency="yes" marginwidth="1" marginheight="1" width="100%" scrolling="no" border="0" frameborder="0" height="100">You need a browser upgrade. Get firefox.</iframe>



The things you'll need adjust in the iframe code to make it work for your site are:



1) src="http://www.YOURSITE.com/PATH-TO-CUTENEWS/search.php"

2) height="100"



How to include search results in your site:

To see the search results on your page, include them into a file called 'search.php' in the root directory of your website. This is exactly like including show_news.php on your index.php file. Because of this I usually copy index.php as search.php (creating http://www.yoursite.com/search.php) and change the include code to this:



<?php

$number = "10";

include("PATH-TO-CUTENEWS/show_searchresults.php");

?>



Some extra info:

You can change the page that cutenews.ru opens search results on by changing this line in search.php:



<form method="get" action="../search.php" target="_top">



Change action="../to-the-name-of-the-file-youd-like-to-use.php"



target="_top" tells it to open in a new window. Without this it will open inside of your tiny search iframe.



You can change which template your search results use in cutenews.ru by modifying this line in search.php:



$template = 'Search';
Attachments
iframe-search.zip
Extract files to root directory of cutenews.ru
(6.07 KiB) Downloaded 258 times
Last edited by scottdallas on Wed May 09, 2007 7:10 pm, edited 3 times in total.
Everyday I'm tumblin http://scodal.tumblr.com
User avatar
scottdallas
 
Posts: 2209
Joined: Thu May 04, 2006 6:46 pm
Location: US

Postby astrostart » Sun May 06, 2007 3:42 pm

Wow, this looks cool.



Do you have a preview so I can check it out before installing it?
My site: http://www.astrostart.nl | Thanks to everyone here who has helped me!
User avatar
astrostart
 
Posts: 124
Joined: Sun Feb 11, 2007 6:08 pm
Location: The Netherlands

Postby yesitsfree » Sun May 06, 2007 7:23 pm

Excellent Thanks for this

I now have it working on my site

Although I had to remove some code out of the show_searchresults.php page due to security errors on my hosting server the part I removed was



Code: Select all
//Search history start

$file_path = "../data/search-history.txt";



if(!file_exists($file_path)) touch($file_path);



$search_file = file($file_path);



if($search){



function plus_one(){

global $search_file, $search, $file_path;



$file = fopen($file_path, w);



   foreach($search_file as $line){

      $line_arr = explode("|", $line);

      if(trim($line_arr[1]) == trim($search)){

         $count = $line_arr[0]+1;

         fwrite($file, $count."|".$line_arr[1]);

      }

      else fwrite($file, $line);

   }

fclose($file);

}



foreach($search_file as $line){

   $line_arr = explode("|", $line);

   $all_words[] = trim($line_arr[1]);

}





   if(in_array($search, $all_words)){

      plus_one();

   }

   else {

      $add_file = fopen($file_path, a);

      fwrite($add_file, "1|".$search."\n");

      fclose($add_file);

   }





}

//Search history end





now works fine

see at www.security4free.co.uk new site being developed so not much on it.
User avatar
yesitsfree
 
Posts: 96
Joined: Thu May 03, 2007 8:49 pm

Postby scottdallas » Sun May 06, 2007 7:31 pm

Everyday I'm tumblin http://scodal.tumblr.com
User avatar
scottdallas
 
Posts: 2209
Joined: Thu May 04, 2006 6:46 pm
Location: US

Postby yesitsfree » Sun May 06, 2007 7:33 pm

maybe just the hosting i am using they are a bit restricted with what you can use
User avatar
yesitsfree
 
Posts: 96
Joined: Thu May 03, 2007 8:49 pm

Postby scottdallas » Sun May 06, 2007 7:34 pm

Ah and now http://www.security4free.co.uk/ has a working example :) I'm glad you got it working. looks and works great. fast and easy :)



You could change the text here:



Code: Select all
Your Search Results Are Below




to



Code: Select all
Your Search Results for '<b><?php echo("$search"); ?></b>' Are Below




If you want to display the keyword they searched
Last edited by scottdallas on Sun May 06, 2007 7:36 pm, edited 1 time in total.
Everyday I'm tumblin http://scodal.tumblr.com
User avatar
scottdallas
 
Posts: 2209
Joined: Thu May 04, 2006 6:46 pm
Location: US

Postby yesitsfree » Sun May 06, 2007 7:36 pm

Yep THANKS for your help Scott
User avatar
yesitsfree
 
Posts: 96
Joined: Thu May 03, 2007 8:49 pm

Postby yesitsfree » Sun May 06, 2007 7:39 pm

Just added "Your search results for "" are below



Great thanks again
User avatar
yesitsfree
 
Posts: 96
Joined: Thu May 03, 2007 8:49 pm

Postby scottdallas » Sun May 06, 2007 7:49 pm

yeah! that looks sweet!
Everyday I'm tumblin http://scodal.tumblr.com
User avatar
scottdallas
 
Posts: 2209
Joined: Thu May 04, 2006 6:46 pm
Location: US

Postby yesitsfree » Sun May 06, 2007 8:01 pm

Yep works great.

Going to get www.security4free.co.uk loaded with software and then Im going to convert yesitsfree to cutenews.ru will take some doing though I have about 600 listings on static pages also worried about losing my google ranking, it is about 4/10 at the moment but all the pages are htm will I loose rankings when I convert to php.
User avatar
yesitsfree
 
Posts: 96
Joined: Thu May 03, 2007 8:49 pm

Postby astrostart » Tue May 08, 2007 11:56 am

I have installed it on my website: www.astrostart.nl (upper right corner)



If I search for one word, it works fantastic, but when I search for two words, it can't find anything.



For instance:



zwart - enough results

zwart gat - no results



That's weird, because there are a lot of news with zwart gat (black hole) on my site.



Do you have a solution? :P
My site: http://www.astrostart.nl | Thanks to everyone here who has helped me!
User avatar
astrostart
 
Posts: 124
Joined: Sun Feb 11, 2007 6:08 pm
Location: The Netherlands

Postby astrostart » Tue May 08, 2007 12:02 pm

And another question (yeah, I'm annoying)



This is my template for next and previous news:



Code: Select all
<p align=center>[prev-link]<< Nieuwere berichten[/prev-link] | [next-link]Oudere berichten >>[/next-link]</p>




However, when I'm on the search page and click 'oudere berichten' (older messages) it takes me to the following link:



http://www.astrostart.nl/search.php?skip=10



And I can't see any newsmessages. Do you have a solution for this? :( [/code]
My site: http://www.astrostart.nl | Thanks to everyone here who has helped me!
User avatar
astrostart
 
Posts: 124
Joined: Sun Feb 11, 2007 6:08 pm
Location: The Netherlands

Postby scottdallas » Wed May 09, 2007 1:49 am

Does this fix it? When I had bad search result pagination links FI-DD helped me here



http://english.cutenews.ru/forum/viewto ... pagination



and I uploaded the zip of the file with the modifications he helped me make in case anyone else had similar issues. As far as the mulitple word search.. I have trouble with that too :( i think that's not the iframe-search having trouble but the search code itself.
Everyday I'm tumblin http://scodal.tumblr.com
User avatar
scottdallas
 
Posts: 2209
Joined: Thu May 04, 2006 6:46 pm
Location: US

Postby FI-DD » Wed May 09, 2007 6:07 pm

You have to install the boolean search if you want to search for more than one word.
User avatar
FI-DD
Admin
 
Posts: 2971
Joined: Thu Sep 22, 2005 11:27 am
Location: Germany

Postby astrostart » Wed May 09, 2007 6:29 pm

Well, I did. But now I've overwritten it with this search.php file. So now it is not possible anymore :P
My site: http://www.astrostart.nl | Thanks to everyone here who has helped me!
User avatar
astrostart
 
Posts: 124
Joined: Sun Feb 11, 2007 6:08 pm
Location: The Netherlands

Next

Return to Additional Downloads



Who is online

Users browsing this forum: No registered users and 0 guests

cron