This topic is locked

literal basic question

7/9/2011 3:51:11 AM
PHPRunner General questions
B
bluepoint author

I am trying to add the following code as a literal in the AfterAppInit function...can't get it check: unexpected '}' in line 1
Whats the secret?
{literal}

<!-- Google Code for E-Mail Sign Up Conversion Page -->

<script type="text/javascript">// <![CDATA[

/ <![CDATA[ / var google_conversion_id = 10081477753; var google_conversion_language = "en"; var google_conversion_format = "3"; var google_conversion_color = "ffffff"; var google_conversion_label = "U4a7CLuj6gIQ_YXc4AM"; var google_conversion_value = 0; / /

// ]]></script>

<script src="http://www.googleadservices.com/pagead/conversion.js"; type="text/javascript">

</script>

<noscript>

<div style="display:inline;">

<img height="1" width="1" style="border-style:none;" alt="" src="http://www.googleadservices.com/pagead/conversion/1008141053/?label=U4a7CLuj6gIQ_YXc4AM&amp;guid=ON&amp;script=0"/></div>;

</noscript>

{/literal}

C
cgphp 7/9/2011

Take a look at the manual page of the AfterAppInit: http://xlinesoft.com/phprunner/docs/after_application_initialized.htm
Instead, place the code in the header section. {literal} is not necessary.

B
bluepoint author 7/9/2011



Take a look at the manual page of the AfterAppInit: http://xlinesoft.com/phprunner/docs/after_application_initialized.htm
Instead, place the code in the header section. {literal} is not necessary.


Yes but will this header not get painted each time a page in the application paints? This would mess up the google analytics with too many hits. Just want one per entry. Why does the above not work?

C
cgphp 7/9/2011

Yes, but in the header you can check the current page with the following code:

$current_page = basename($_SERVER['REQUEST_URI']);



and echo the google script if $current_page is the target page.

B
bluepoint author 7/9/2011



Yes, but in the header you can check the current page with the following code:

$current_page = basename($_SERVER['REQUEST_URI']);



and echo the google script if $current_page is the target page.


The user will toggle around in circles the following links on the application by clicking various

options....it is on the quiz (http://xlinesoft.com/blog/2011/05/10/quiz-template/)
http://www.xyz.com/quiz/responses_add.php?testid=1

http://www.xyz/quiz/responses_add.php

http://www.xyz.com/quiz/responses_add.php?testid=1&showanswers=1
If I put what you suggest it will get multiple hits as I want to track when they enter the application once only...
So the original way to solve this won't work...you seem to resist for some reason my original questions, does the

package not work like this?

C
cgphp 7/10/2011

I'm not resisting your original question...I see what you mean, but AfterAppInit event accepts only PHP code and its primary function is to override any global variables or to initialize custom variables or to include php files.
Just so we are clear about this, every time you ask for a new page the code in this event is executed. So, it is executed in the beginning of each request. Anyway, according to me is not the right place where to put the google script <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=59343&image=1&table=forumreplies' class='bbc_emoticon' alt=':lol:' />
The google conversion tracking code must appears within a static HTML section. You should place the conversion tracking code snippet directly into the body of the conversion confirmation page (from google guide).

Sergey Kornilov admin 7/11/2011

Try to paste this code (without {literal} and {/literal}) right to HTML code template. You can do that in Visual Editor in HTML mode.