Community @ The Turning Gate

Support community for TTG plugins and products.

You are not logged in.

#1 2015-10-23 18:49:54

netisfred
Member
Registered: 2015-10-05
Posts: 34

Adding code in the Head for mobile and index php

Hello everyone,

I come back for a new question about adding 2 lines of code in the head of a gallery and also in Pages.
I already spoke about adding links to thumbnails images in precedent posts and found some solutions.

Here the workflow :
For the Gallery :
1/ I add a different link in the UrlCopyright of each different image. (Purchase button and link)
    Ask to the gallery template to show it (and it works when exporting the gallery, not with publisher)

2/ I have to add two lines of code in the head of the index file and mobile file. (Basket links)
--> I pasted directly in them the code in the beginning of the head, before everything else. --> it worked.

3 / Now I have succeeded doing this, I would like to make the part 2 also automatic, with phpPlugin.
But :
In phpPlugin, I can just add some lines at the "End" of Head. And when doing that, the code doesn't work.

So seeing how the Php plugin works, I tried this :

Add in the index and mobile php files of the gallery : Part A :
Head start :
// if ( function_exists('ttg_head_start') ) {
//    $void = ttg_head_start( TTG_COMP, TTG_ROOT );
// } ?>

And in the Phplugins.php : Part B

// function ttg_head_start( $style, $path ) {
//    echo '
// <link rel="stylesheet" href="http:etc..." />
//    <script src="http://www.etc.../script.js"></script>
//
//    ';
// } // END

And it works.
But now I have done that, I would like to make it automatic when I export Gallery and Pages from lightroom. If I'm right, I have to make some changes in the webEngine no ? If yes, in which files do I have to add my part A ? For the part B I keep this in the phpPlugin file.
To prevent any problem, I will duplicate gallery and pages webeengines, and rename them for this special workflow, doing this, I hope to see them in lightroom..

So would you have some advices for this last part ? In which files of the "Pages" and "Gallery" webengine I will have to add this little code in the head, and also, is this a good idea to make some changes in the webengine, and duplicate them ? Or, is there a simpler way ?

Thank you very much for your answers.
F.

Last edited by netisfred (2015-10-23 18:50:28)

Offline

#2 2015-10-23 19:57:12

netisfred
Member
Registered: 2015-10-05
Posts: 34

Re: Adding code in the Head for mobile and index php

Ok so...
I found a solution but I keep my precedent question smile
What I have done :

In the Gallery webEngine, pasted this code in the HEAD.html : (almost the same as ttg_head_end)

// <% if publish and M.phplugins.enable then write ("<?php\n" ..
// "if ( function_exists('ttg_head_start') ) {\n"..
// "    $void = ttg_head_start( TTG_COMP, TTG_ROOT );\n"..
// "} ".."?"..">") end --[[ ttg_head_start ]] %>

And pasted the master code in the Phplugins.php.

//function ttg_head_start( $style, $path ) {
//    echo '
//<link rel="stylesheet" href="http://www...." />
//    <script src="http://www....script.js"></script>
//
//    ';
// } // END


And so far, it works when exporting the gallery with lightroom.
Have to check if a publisher still work with these changes now.. 
Verified another thing, it doesn't work to duplicate and rename a webEngine, Lightroom doesn't recognize it.. sad So if you have a solution for this...
For now, the changement is for all the gallery pages...

I will try now to do this for the Pages module, in order to have the "basket" on all the pages.


And still, do you think it has been a good solution ?

Thank you.
F.

Offline

#3 2015-10-23 20:57:56

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

Re: Adding code in the Head for mobile and index php

Altering the web engine appears to be a violation of the End Users License Agreement.
http://ce4.theturninggate.net/docs/doku.php?id=eula

You can use phplugins to add the style sheet to the <head> Like you already have done.

Have you tried using the CopyrightURL token to add the needed information to the images with Publisher?
http://ce4.theturninggate.net/docs/doku … ata_tokens


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

Offline

#4 2015-10-23 21:08:42

netisfred
Member
Registered: 2015-10-05
Posts: 34

Re: Adding code in the Head for mobile and index php

Ouch, I didn't know that ! hmm My bad hmm
As I saw some other posts about changing some lines of code in the Engine, for the problem of quotes (I don't remember where in the forum...) I thought it was ok...

So I don't know how to do... sad

Use only phpPlugins didn't work.. It add the code at the end of the Head and no success... If there is a way to put it right under the start of the "Head", I will be glad to know it, without altering the engine..

For the token, yes I tried. I have mentioned it in other posts, about the problem of quotes and other signs. They are "translated" in html code when publishing... The information I put in the Urlcopyright is like this :
<a class="wl-photo-order" rel="nofollow" href="http://www......">Command</a>

Offline

#5 2015-10-23 21:21:04

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

Re: Adding code in the Head for mobile and index php

Use ttg_head_end to add code to the head. There is no ttg_head_start hook

http://ce4.theturninggate.net/docs/doku … _functions


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

Offline

#6 2015-10-23 21:43:10

netisfred
Member
Registered: 2015-10-05
Posts: 34

Re: Adding code in the Head for mobile and index php

Yes it is exactly what I tried..
So ok I erased everything and restarted. Go back to the non altered module, and retried this.

As before, it makes problems:
For the shop gallery it works. (Exported with lightroom)
But all the others galleries (publisher) are broken. Nothing load.

EDIT :
/// The problem I think is in the code I have to paste, this kind of "popup" for the basket : it has also a Css... /// --> No
----> Yes, The problem comes with the script.js. It breaks the others galleries, when it is at the end of the head. 


well.. maybe another idea...
Lets try another PhpPlugin folder to see.. To avoid altering the firsts galleries, and link only this "shop" gallery.

Any idea with the translation of quotes and signs in html code, with Publisher  ?

Thank you Rod, and sorry for my bad utilisation of the Engine.

Last edited by netisfred (2015-10-23 21:49:54)

Offline

#7 2015-10-23 22:51:10

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

Re: Adding code in the Head for mobile and index php

Any idea with the translation of quotes and signs in html code, with Publisher  ?

No, sorry. I don't really know much about how all that works, but if you can learn LUA, you might be able to squeeze what you need in there:
http://ce4.theturninggate.net/docs/doku … lua__token


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

Offline

#8 2015-10-23 22:57:57

netisfred
Member
Registered: 2015-10-05
Posts: 34

Re: Adding code in the Head for mobile and index php

Yes I had a look on this page and tested, but impossible, I didn't find any solution to avoid the translation of quotes and signs like <>, even with LUA..
Maybe someone know how to do, but I tried many many times and no success.

For the precedent problem, it's ok. It works with another Phplugin folder with another name. So the shop will have his own phplugin folder and the main website his own too. Not perfect, but it works. Until I have to use publisher to upload galleries in the shop. I will see that at this moment..

Offline

Board footer

Powered by FluxBB