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.
You are not logged in.
Pages: 1
I am wondering if there is a way to insert custom header HTML. I have some code that I would like on all of my templates... Anyone have thoughts on the best way to incorporate that?
Sitting Pretty in Sunny L.A.
Offline
Yes, you can do this using the phplugins API functions.
Daniel Leu | Photography
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com
Offline
I am wishing to put a simple piece of java script in the header or footer of each page.... I am assuming this would be placed in the phplugins.php document. Can I just insert the script below the "/// SET USER FUNCTIONS BLEOW" or would it need special commands to function properly? Thanks for any assistance you can provide!
Sitting Pretty in Sunny L.A.
Offline
No, you need to direct where on the page the code is going using one of the hooks, like ttg_head_end or ttg_body_bottom
then you use the echo statement to insert the code in that portion of the page
see the phplugins documentation and the examples for how to do this.
http://ce4.theturninggate.net/docs/doku … _phplugins
Rod
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site
Offline
No, you need to direct where on the page the code is going using one of the hooks, like ttg_head_end or ttg_body_bottom
then you use the echo statement to insert the code in that portion of the pagesee the phplugins documentation and the examples for how to do this.
http://ce4.theturninggate.net/docs/doku … _phplugins
with the Piwik JAVA Script code the page shown a blank page on my side. with the image tracking code it works.
Offline
with the Piwik JAVA Script code the page shown a blank page on my side. with the image tracking code it works.
the blank page was probably caused by syntax errors in the code (perhaps single quotes where double quotes were needed)
Rod
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site
Offline
with the Piwik JAVA Script code the page shown a blank page on my side. with the image tracking code it works.
the blank page was probably caused by syntax errors in the code (perhaps single quotes where double quotes were needed)
i copy paste the code from piwik to the section in the php document.
Offline
i copy paste the code from piwik to the section in the php document.
and it could have contained some sections with single quotes. If you put that after an echo' statement, it will break the page. Those single quotes you got from piwik probably need to be changes to either double quotes or they need to be escaped with a backslash.
nothing wrong with the code by itself, but it probably created a syntax error with the php code it was inserted into.
Rod
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site
Offline
This is my code. i am not firm enough with coding. what i have to replace?
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u=(("https:" == document.location.protocol) ? "https" : "http") + "://www.XXX.de/piwik/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', X]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript';
g.defer=true; g.async=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img src="http://www.XXX.de/piwik/piwik.php?idsite=X" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
i copy paste the code from piwik to the section in the php document.
and it could have contained some sections with single quotes. If you put that after an echo' statement, it will break the page. Those single quotes you got from piwik probably need to be changes to either double quotes or they need to be escaped with a backslash.
nothing wrong with the code by itself, but it probably created a syntax error with the php code it was inserted into.
Offline
if you've put this code inside of an echo statement, then you'd probably need to escape all the single quotes by placing a backslash in front of them.
for example, this part of your code:
_paq.push(['trackPageView']);
would need to become this:
_paq.push([\'trackPageView\']);
Rod
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site
Offline
Having the same issue with blank page returned... here is the block I am inserting...
function ttg_body_bottom( $style, $path ) {
echo '
<script type="text/javascript">
/* <![CDATA[ */
document.write (
'<img src="http://photography.hursey.com/acton/bn/13476/visitor.gif?ts='+
new Date().getTime()+
'&ref='+escape(document.referrer) + '">'
);
var aoAccountId = '13476';
var aoCookieMode = 'STANDARD';
var aoCookieDomain = 'hursey.com';
var aoServerContext = 'http://photography.hursey.com/acton';
/* ]]> */
</script>
';
return false;
}
Sitting Pretty in Sunny L.A.
Offline
try escaping all the single quotes other than the one following echo and the last one before the semi-colon before the return false;
What's happening is that the echo statement places whatever is between its single quotes in the page. So that echo ends as soon as it hits the next single quote, the one directly after
document.write {
and the page breaks. Probably because of the code following that single quote.
Rod
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site
Offline
they're easy to miss
Rod
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site
Offline
Pages: 1