Welcome Guest, Not a member yet? Register   Sign In
Static page search
#1

[eluser]aryan_[/eluser]
I am a newbie php programmer. How do search local pages using CI. I don't want to use any third party plugin.

One more query - Is there form_image() or similar to put an image type button?
#2

[eluser]TheFuzzy0ne[/eluser]
Can you be more specific? What do you mean by "search local pages"?

No, there's no helper for creating a form image, but there's nothing stopping your creating one. Smile
#3

[eluser]aryan_[/eluser]
[quote author="TheFuzzy0ne" date="1237225354"]Can you be more specific? What do you mean by "search local pages"?

No, there's no helper for creating a form image, but there's nothing stopping your creating one. Smile[/quote]

Searching Views with static content. Not searching the database. This functionality is found on several website. I don't know how to do that.

How do I create form_image()?
#4

[eluser]pistolPete[/eluser]
[quote author="aryan_" date="1237231183"]
How do I create form_image()?[/quote]
MY_form_helper.php :
Code:
<?php

function form_image($data = '', $src = '', $alt='', $extra = '')
{
    $defaults = array('type' => 'image', 'name' => (( ! is_array($data)) ? $data : ''), 'src' => $src, 'alt' => $alt);
    return "<input "._parse_form_attributes($data, $defaults).$extra." />";
}

/* End of file MY_form_helper.php */
/* Location: ./system/application/helpers/MY_form_helper.php */

usage:
Code:
$this->load->helper('form');
echo form_image('input_name','/path/to/image.ext','alt text');
#5

[eluser]TheFuzzy0ne[/eluser]
I still don't understand what you want to search for in your views, and why you don't use a database, it will be much quicker.

Sorry, the information I gave you with regards to creating a form image was not correct.
Code:
$data = array(
        'type' => "image",
        'src' => "/images/myimage.gif",
        'name' => "myImage",
        'alt' => "some text",
        
    );

$value = 'blah';

echo form_input($data, $value);

Hope this helps.
#6

[eluser]jedd[/eluser]
Quote:Searching Views with static content. Not searching the database. This functionality is found on several website. I don't know how to do that.

What a lot of sites do is throw it out to google, along with the ol' site:.yourdomain.com.au in the search string.
#7

[eluser]aryan_[/eluser]
Thanks for form_image(). One of my project has several static pages/views. I want to search them. I don't want to use google.

I have seen several sites with their own search functionality. How does people do search on their sites without help of google?

In simple word, I want to perform the regular search functionality for static pages/views without google or any third party tool.

Thanks a lot!
#8

[eluser]TheFuzzy0ne[/eluser]
Google uses databases to store/index the data. If you perform a regex search every time on all of your pages, you're probably going to have a seriously slow site, or worse, your Web host may suspend your account. I strongly suggest you look into indexing the data you need in a database.

Please could you give an example of one of these sites with their own search functionality?
#9

[eluser]xwero[/eluser]
if your server runs php5 you could add the zend lucene library, here is an article about it.

going through all your static pages in real time would be madness.
#10

[eluser]aryan_[/eluser]
ya, I did some search and found that I'll have to use DB. How can I do it with CI? Any sample code or tutorial?

Should I put my static page content to DB and search them?




Theme © iAndrew 2016 - Forum software by © MyBB