Community @ The Turning Gate

Support community for TTG plugins and products.

NOTICE

The Turning Gate's Community has moved to a new home, at https://discourse.theturninggate.net.

This forum is now closed, and exists here as a read-only archive.

  • New user registrations are disabled.
  • Users cannot create new topics.
  • Users cannot reply to existing topics.

You are not logged in.

#1 2015-02-10 13:01:19

contact
Member
Registered: 2015-01-15
Posts: 28

Modify search module...

Hello,

I'm looking for a solution to open my web site directly on the "search page" and not the home page. Is it possible?

Also, is it possible to modify the search module? For example: change the color, change the position, add icon…?
How can I do it?

Thank you for your help
Marc

Offline

#2 2015-02-10 23:29:14

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Modify search module...

Your search page can use one of your gallery templates.
The form colors can be styled from Site Info > Typography > Forms. (If you're using the Share Resources with TTG CE4 Pages feature, I believe you'll need to change the form styling in Pages)

You can add an icon using the syntax to add a Font Awesome Icon. do this in ttg-be Publisher settings. Just add it to the Search Title field. (see my search page )
Here's the code to add a magnifying glass search icon: <i class="fa fa-search"></i>

I just created a post about this: http://ttg-tips-and-tricks.barbeephoto. … e-heading/

Changing position would be tricky. You'd likely need to use phplugins to essentially replace the block with your own coded structure.
But take a look at the page structure before and after search results. It gets even more complicated from there.

Ben mentioned in the forum awhile back that he was working on being able to modify the main content area via the Publisher set up. So wait and see what he comes up with.


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#3 2015-02-11 00:02:27

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Modify search module...

as for having the search page as the home page, probably not. But you can put a search form on your home page.

The way to do that is to look at the page source for your search page. Look for the form, it looks like this:

<div id="search" class="collapse clearfix">
<h2>Photo Search</h2>
<form action="./" method="GET">
<input type="text" id="q" name="q" value=""/>
<button type="submit">Search</button>
</form>
</div> <!-- #search -->

copy that code and insert it in the Page Copy (md) field of your home page. I'd suggest putting it in the sidebar.
You'll need to modify one part of the code. Change this:

<form action="./" method="GET">

to this:

<form action="/search" method="GET">

this assumes your search page is in the root of the site. If not, change the path accordingly.


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#4 2015-02-11 18:16:48

contact
Member
Registered: 2015-01-15
Posts: 28

Re: Modify search module...

Hello,

I have some difficulties to find the "search page" and the code you've indicate in your post… What file is it please?

Regards
Marc

Offline

#5 2015-02-11 21:35:16

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Modify search module...

Just go to your search page on your site. To view the page source just right click and choose "view page source"
Copy from that. Or simply copy and modify the code I posted above, it's the same.

http://ttg-tips-and-tricks.barbeephoto. … -ttg-page/


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#6 2015-02-11 22:13:34

kmlucy
Member
From: Atlanta, GA
Registered: 2013-01-30
Posts: 123
Website

Re: Modify search module...

I modified my search page to hide the album search using PHPlugins to replace the block. Here is my function if you are interested:

function ttg_block_top( $style, $path ) {
    if (G_PATH == 'SEARCH') {
        echo '
        <div id="primary-content" class="container_12 collapse clearfix">
        <div id="search" class="collapse clearfix">
        <h2>Search</h2>
        <hr />
        <form action="./" method="GET">
        <input type="text" id="q" name="q" value=""/>
        <button type="submit">Search</button>
        </form>
        </div> <!-- #search -->
        </div>
        ';
        return false; 
    }
    return true;
} // END

You can take a look here (try searching for 'Nassau'). I also increased the max width via custom css:

#search {
    max-width: 1140px;
    }

Last edited by kmlucy (2015-02-11 22:21:06)


Kyle Lucy Photography
kylelucy.com

Offline

#7 2015-02-15 04:25:52

kmlucy
Member
From: Atlanta, GA
Registered: 2013-01-30
Posts: 123
Website

Re: Modify search module...

This is a much cleaner way of doing the same thing. This leaves the original search intact, and just hides the unwanted information, as opposed to overwriting the whole search page. With this function, the search term stays in the search bar, and you get a message for 'no photos found'.

function ttg_block_bottom( $style, $path ) {
    if (G_PATH == 'SEARCH') {    
        echo '
        <script>
        (function(){
            if(document.getElementById("content")!=undefined){            
                if(document.getElementById("content").innerHTML.indexOf("criteria")>-1){
                    document.getElementById("content").innerHTML="<p><cite>No photos matched your search criteria</cite></p>";
                } else {
                    document.getElementById("content").style.display="none";
                }
            }
        })();
        </script>
        ';
    }
} // END

Kyle Lucy Photography
kylelucy.com

Offline

Board footer

Powered by FluxBB