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-11-08 22:43:29

theomolenaar
Member
Registered: 2012-12-11
Posts: 163

Header

In my current site I have a Header per Gallery. Separate jpegs, so i have as much templates (also for naming, text etc.) as I have gallery (not using publisher). 

I now want to use publisher. I made the logo shorter and have the text filled from the template. However I want different text for different albums.

The site tiltle (as displayed by the browsers tab) is litang to kanding - Travel etc...

http://test.theomolenaar.nl/galleries/a … o-kanding/

I would like the album title from publisher to be in the header in stead of Pictures of a big world (this is only for the homepage).

That will probabely mean usingTTG hooks. I read the manual so oI sort of get the Idea, but my knowledge of code is practically zero..

Last edited by theomolenaar (2015-11-08 22:45:27)

Offline

#2 2015-11-09 03:00:08

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

Re: Header

yep. phplugins will be needed. Be sure to use a plain text editor for editing the phplugins.php file

What you'll probably need to do is completely replace the header in your galleries using the ttg-header_masthead hook
http://ce4.theturninggate.net/docs/doku … r_masthead

You'll need to do this conditionally so that it only happens to your albums, much like Matt shows here:
http://ce4.theturninggate.net/docs/doku … _functions

The way to go about this is to look at the source code of one of your galleries in a browser and copy the html that displays the masthead.
You'll then add this code, with the modifications you'll need to make, into a function in your phplugins file using an echo' ';

Fortunately, Matt has added some phplugins constants that you can use. One of them is ALBUMTITLE
http://ce4.theturninggate.net/docs/doku … albumtitle

What you can try is removing the html that displays the Album Description (since you only wanted the album title in the masthead) and then insert the constant ALBUMTITLE into the appropriate spot in the html to replace the album title that's already there.

I use the same concept of copying code and inserting it via phplugins in this post:
http://ttg-tips-and-tricks.barbeephoto. … avigation/
that should give you a start.

If I have some time this week I'll try to play what you're trying to do to see if I can get it to work.

You'll probably break your site when trying this; there always seems to be a syntax error someplace along the line. When that happens, just undo whatever you did in the phplugins.php file and upload it again. Or keep a back up copy of your phplugins.php file handy and just upload that. This way your site won't be down for more than a few seconds at a time.


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-11-09 22:57:33

theomolenaar
Member
Registered: 2012-12-11
Posts: 163

Re: Header

Thanks

I'll start working on it. Always saving the last one that worked.. It  is not a real problem if the site is down. It is a test. When it is working and coplete I reroute the pictures subdomain....

Offline

#4 2015-11-09 23:10:06

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

Re: Header

I think I figured it out. I've not tested it yet though


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

Offline

#5 2015-11-10 00:15:09

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

Re: Header

Yay! Got it to work:

function ttg_header_masthead( $style, $path) {
    if (G_STYLE == 'CE4-GALLERY') {
        echo '
            <div id="masthead" class="block-id masthead clearfix"> 
                <div class="mantle clearfix">
                    <div class="core clearfix">
                <div id="profile-image" class="profile-image clearfix">
                <div id="profile-icon" class="profile-icon clearfix">
                <a href="/"><img alt="Your Site Title" src="/lib/images/identityplate.png" width="342" height="42" /></a>
                </div>
                <div id="profile-labels" class="profile-labels clearfix">             
                    <h1><span><a href="#">' . ALBUMTITLE . '</a></span></h1>                     
                </div>
                </div><!-- #profile-image -->
                    </div>
                </div>
            </div> <!-- #masthead --> 
            ';
            return false;  // replaces normal mastead for CE4 Gallery pages
    }
    return true;  //Pages not CE4-Gallery use normal masthead
} //END

Line 9 contains the link to the home page with your masthead image. I've modified it so that it isn't dependent on the gallery or publisher template.
Line 12 is the code that places the Album Title in place of the Site Title:

<h1><span><a href="#">' . ALBUMTITLE . '</a></span></h1>

in the example above I've replace the original link that would take you back to the home page with a link that doesn't go anywhere.
If you don't want a link at all, try using this instead:

<h1>' . ALBUMTITLE . '</h1>

not tested in all configurations so your mileage may vary


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-11-10 23:00:05

theomolenaar
Member
Registered: 2012-12-11
Posts: 163

Re: Header

Great

Ill try this.

After your first reply I sort of decided that I also like the album description in the header. So I'll add that too. Same for the autoindex.

Offline

#7 2015-11-10 23:29:09

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

Re: Header

Album description will likely be harder to do; there is no existing phplugins constant for that.
But you might be able to figure out what's being used by looking at the exported index.php file and finding something you can use in the php.


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

Offline

#8 2015-11-10 23:35:43

theomolenaar
Member
Registered: 2012-12-11
Posts: 163

Re: Header

Alas

It does not work the identityplate is not found.

Offline

#9 2015-11-10 23:45:41

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

Re: Header

you'll probably just need to edit the code for the correct path to the identity plate. It all depends on how your site is set up.
The code I have above assumes your assets are in the root of the site. If they are in a sub-folder you need to adjust for that.


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

Offline

#10 2015-11-10 23:48:10

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

Re: Header

your code is looking for the identity plate in "./lib/images/...."
try: "/galleries/lib/images/identityplate.png"


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

Offline

#11 2015-11-11 01:37:43

theomolenaar
Member
Registered: 2012-12-11
Posts: 163

Re: Header

Thanks for the info

An identity plate was found. But somehow an old one, not the one that was exported recently. But given this I can figure out where to put it. My templates are in the gallery als was in the Manual. My skills in directories, paths etc. are quite rusty i am afraid.

But with the current info i can figure it out....

Thxs

Offline

#12 2015-11-11 01:50:50

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

Re: Header

you could place your identityplate.png in a separate folder you create and then provide the path to it. This keeps it protected from any new uploads.


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

Offline

#13 2015-11-11 19:13:17

theomolenaar
Member
Registered: 2012-12-11
Posts: 163

Re: Header

Yes

The identityplates where way deep in the template folders under BE under Galleries. Put it in galleries/lib and it works. I guess that makes sense because the galleries folder is where TTG 'lives'

Thanks again for the support

Offline

#14 2015-11-13 06:27:15

theomolenaar
Member
Registered: 2012-12-11
Posts: 163

Re: Header

I decided tot ad a subtitle as a literal. Works great.

Only at the album (first) level things are different... Any Idea ?

Offline

#15 2015-11-13 07:10:03

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

Re: Header

Only at the album (first) level things are different... Any Idea ?

not sure what you mean. Where is this? what's different?


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

Offline

#16 2015-11-13 18:06:07

theomolenaar
Member
Registered: 2012-12-11
Posts: 163

Re: Header

I am sorry

When you choose album you get to the first level (diredctory gallery). Then there is no name in that heading. It is a separate occurence of the autoindex script.

http://test.theomolenaar.nl/galleries/

I put a title in the autoindex-xml like there is in the underlying directories but somehow it does not seem to work..

Offline

#17 2015-11-13 22:56:14

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

Re: Header

That's because that page is not a Gallery and the function has a conditional to only replace the masthead if it's a CE4 Gallery.

if (G_STYLE == 'CE4-GALLERY') {

Change the if statement to include autoindexes as well. (or just that one page with the folder name of 'galleries')

you can get an idea of how to do that here: http://ce4.theturninggate.net/docs/doku … a_function


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

Offline

#18 2015-11-14 04:19:31

theomolenaar
Member
Registered: 2012-12-11
Posts: 163

Re: Header

I had already done that and the autoindexes work fine.

if (G_STYLE == 'CE4-GALLERY' || G_STYLE == 'CE4-AUTOINDEX')

Only not on the galleries page. I tried to fill the proper headline in the autoindex.xml like I saw in the other directories

<?xml version="1.0" encoding="UTF-8"?>
<album>
    <access>unlocked</access>   
    <thumbnail></thumbnail>
    <title>Pictures of a big world</title>
    <description></description>
    <url></url>
</album>

That did not do anything.

Offline

#19 2015-11-14 04:24:03

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

Re: Header

the autoindex.xml file for that page seems...weird. Did you add this information to the Album Info section of Color Palette in the autoindex you're using for this page?

http://test.theomolenaar.nl/galleries/autoindex.xml


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

Offline

#20 2015-11-14 04:48:44

theomolenaar
Member
Registered: 2012-12-11
Posts: 163

Re: Header

And I tried you suggestion But it did not work (syntax I guess, I do not know enough I guess. Could I exclude  G_PATH=galleries somehow ?

I tried

    if (G_STYLE == 'CE4-GALLERY' || G_STYLE == 'CE4-AUTOINDEX')
{
        echo '
            <div id="masthead" class="block-id masthead clearfix">
                <div class="mantle clearfix">
                    <div class="core clearfix">
                <div id="profile-image" class="profile-image clearfix">
                <div id="profile-icon" class="profile-icon clearfix">
                <a href="/"><img alt="Pictures.theomolenaar.nl - A visual blog" src="/galleries/lib/images/identityplate.png" width="402" height="90" /></a>
                </div>
                <div id="profile-labels" class="profile-labels clearfix"> 

                if (G_PATH == 'galleries' || G_PATH == 'albums'){

                                  <h1><span><a href="#">Pictures of a big world</a></span></h1> 
                        <h2><span>A visual travel blog</span></h2 
                else
                              
                                 <h1><span><a href="#">' . ALBUMTITLE . '</a></span></h1> 
                        <h2><span>A visual travel blog</span></h2>
                }
                       
                </div>
                </div><!-- #profile-image -->
                    </div>
                </div>
            </div> <!-- #masthead -->
            ';
            return false;  // replaces normal mastead for CE4 Gallery pages
    }
    return true;  //Pages not CE4-Gallery use normal masthead

Offline

#21 2015-11-14 05:23:40

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

Re: Header

yep, the syntax is all messed up.

Take a closer look at some of Matt's examples.

for instance, you can't drop this:

  if (G_PATH == 'galleries' || G_PATH == 'albums'){

in the middle of an echo. it won't do anything other than break your site. The single quote inside of that is breaking the echo statement.

Also, I believe things are case sensitive:  G_PATH == 'GALLERIES' instead of 'galleries'

also: G_PATH == 'albums' . Do you have a folder named 'albums' somewhere?

if you want that masthead replaced for all those instances you could just string them together:

 if (G_STYLE == 'CE4-GALLERY' || G_STYLE == 'CE4-AUTOINDEX' || G_PATH == 'GALLERIES' || G_PATH == 'ALBUMS') {

assuming you have a folder somewhere named 'albums' that you're targeting.


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

Offline

#22 2015-11-15 03:27:22

theomolenaar
Member
Registered: 2012-12-11
Posts: 163

Re: Header

I thought so. Since I know practically nothing about php. I do know Cobol, but that doesnt help.

I do not get it if it i case sensitive then it should be galleries because the directory is lowercase.

I believe that your suggestion does what you say. That is doing what your first piece of code specified: it replaces the masthead.

But I can see it already does that because it is an autoindex. However it fills the albumtitle in the header. And for the galleries folder the . ALBUMTITLE . field appears to be empty.

So if it would be possible to make the fist thing G_PATH IS NOT 'GALLERIES' it might do the trick. I am going to try that

I want to change the galleries folder into albums later because that is whats in my menu.

Offline

#23 2015-11-15 03:37:12

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

Re: Header

I do not get it if it i case sensitive

by that I meant that it needs to be in all CAPS in the code, just like Matt's examples.

However it fills the albumtitle in the header. And for the galleries folder the . ALBUMTITLE . field appears to be empty.

I'm able to get it to work in album sets (autoindexes) by just making the conditional line:

if (G_STYLE == 'CE4-GALLERY' || G_STYLE == 'CE4-AUTOINDEX') {

So if it would be possible to make the fist thing G_PATH IS NOT 'GALLERIES' it might do the trick

I doubt it, but if you want to try, the syntax is:

G_PATH != 'GALLERIES'

but by just using G_STYLE == 'CE4-GALLERY', that assures the code is sent only to pages made with CE4 Gallery and will exclude autoindexes


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

Offline

#24 2015-11-15 04:18:54

theomolenaar
Member
Registered: 2012-12-11
Posts: 163

Re: Header

I think we do not understood each other. I may have been unclear.

I want the album title to appear in the galleries and autoindixes. You gave me code for the galleries and I added the autoindexes. Later we added the mobile. And all the autoindexes and galleries are replaced. I can see that in the H2 (a visual travel blog) that is not in the LR export.

So far so good.

I had:

galleries---------------------No header, correct subheader and identity plate
--Asia------------------------correct header: Asia, correct subheader and identity plate
----China------------------------correct header: China, correct subheader and identity plate
------Albums------------------------correct header:the albumtitle, correct subheader and identity plate

So what is missing is an album title for the galleries level. So i wanted  to exclude that.

I want to include all galleries and autoindices except the one on the galleries level. Because I guess the . ALBUMTITLE. is empty at that level.

So i tried to find examples of use of parenthesis like if

((G_STYLE == 'CE4-GALLERY' || G_STYLE == 'CE4-AUTOINDEX') AND (G_PATH != 'GALLERIES') )

and after some trail and error got it working. You can see the different header. I have t make that right in the templates etc. but that is something I'll  handle later.

thxs or gettig me on the right path with the uppercase and statement. Would have taken me quite some time to figure that out...

Last edited by theomolenaar (2015-11-15 04:20:01)

Offline

#25 2015-11-15 04:47:32

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

Re: Header

I want to include all galleries and autoindices except the one on the galleries level. Because I guess the . ALBUMTITLE. is empty at that level.

it's only empty if you didn't fill it out in Color Palette > Album Info

If you want the Album title in the header of all autoindexes/album sets and all galleries/albums, then maybe try writing the conditional this way

function ttg_header_masthead( $style, $path) {

    if (G_PATH == 'GALLERIES') {
    return true;
    }
    
    elseif (G_STYLE == 'CE4-GALLERY' || G_STYLE == 'CE4-AUTOINDEX') {
        echo '
            masthead replacement code 
            
            ';
            return false;  // replaces normal masthead for CE4 Gallery pages
    }
    return true;  //TTG Pages not CE4-Gallery or CE4-Autoindex use normal masthead
} //END

I'm not php expert so I'm not sure if that elseif needs to be followed up by an else.

the way you wrote it won't work (AND should be && I believe) and if it was, then it would mean that either a page needed to be a gallery or an autoindex and at the same time needed to be in a folder named 'galleries' for the code to execute.


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

Offline

Board footer

Powered by FluxBB