Injecting values from Pligg into Google Script

Register an Account
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 06-02-2007, 05:10 PM
Constant Pligger
 
Join Date: Apr 2007
Posts: 168
I am trying to inject the value from my link_field10 into this google script. I included this script in my link_summary.tpl and enclosed it in {literal} tags, as recommended in the forum. Here is the google script from my link_summary.tpl

{literal}
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=mysecret key" t ype="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallZoomControl());
map.setCenter(new GLatLng(37.4419, -122.1419), 15);
}
}
//]]>
</script>
{/literal}

Basically the value stored in my link_field10 consist of 2 integers seperated by a comma, eg. 37.4419, -122.1419

If I enter the numbers directly into the above script, as I have shown above, it displays fine. If I replace the above numbers with $link_field10, it does not work. I want to dynamically load the value of $link_field10 into this script when the story page loads

Can someone tell me what I need to do?

Ash?

Thx

Last edited by aaronpais; 06-02-2007 at 05:15 PM.
Reply With Quote
  #2 (permalink)  
Old 06-02-2007, 05:13 PM
AshDigg's Avatar
Mayor of PliggVille/Coder
 
Join Date: Dec 2005
Posts: 1,515
You're not going to be able to if you use literal. What you need to do, instead of literal, is replace { with {ldelim} and } with {rdelim}. Then you can use {$link_field10}.

PHP Code:
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=abcdefg" type="text/javascript"></script> <script type="text/javascript">
//<![CDATA[ function load() {ldelim} if (GBrowserIsCompatible()) {ldelim} var map = new GMap2(document.getElementById("map")); map.setCenter(new GLatLng({$link_field10}), 13); {rdelim} {rdelim} //]]> </script> 
Reply With Quote
  #3 (permalink)  
Old 06-02-2007, 05:17 PM
Constant Pligger
 
Join Date: Apr 2007
Posts: 168
Ash, sorry I am not a developer and am fiddling around trying to get some functionality to work. What do you mean by replacing

{ with {ldelim}

and

} with {rdelim}

I cleaned up the previous code that Iposted to make it cleaner in the original post..

Thx
Reply With Quote
  #4 (permalink)  
Old 06-02-2007, 05:21 PM
AshDigg's Avatar
Mayor of PliggVille/Coder
 
Join Date: Dec 2005
Posts: 1,515
I edited my post with the code you should use.
Reply With Quote
  #5 (permalink)  
Old 06-02-2007, 05:23 PM
Constant Pligger
 
Join Date: Apr 2007
Posts: 168
Thx so much. it works...
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pligg and google optimization. can8dn Questions and Comments 10 12-01-2007 07:36 AM
URGENT: Have 80% Pligg Design Done, Need Experienced Programmer/Designer to finish it anothercollegestudent Questions and Comments 3 11-07-2007 02:39 AM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development