Webmastersite.net
Register Log In

Passing url variables
into javascript export template

Comments on Passing url variables

mrowton
Forum Regular

Usergroup: Customer
Joined: Feb 19, 2004
Location: Michigan

Total Topics: 57
Total Comments: 185
mrowton
Posted Apr 05, 2006 - 11:09 AM:

Is there anyway to pass variables into the javascript feed template?

Here's an example url
<script language="javascript" src="http://www.domain.com/exporter.php?number[1]=10&field[1]=time&ascdesc[1]=descending&type[1]&links&feedwidth=100"></script>

And then put something like this in my javascript template?
<table width="<?php echo $feedwidth; ?>" border="1">


Or is there some other way I could do something like this?
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Apr 05, 2006 - 11:49 PM:

As described at scripts.webmastersite.net/w...s/Global_Variables-14.html anything passed in the url is available as a template variable.

That'll work in toplist conditions, but anywhere else in the javascript template I don't see the applicable. The javascript stuff had that specially removed in order to speed things up. In export.php you can replace
$toplist = str_replace("\r\n", "", $toplist); 
with
$toplist = str_replace("\r\n", "", $toplist); 
$toplist = generalreplacements($toplist);
... just the example you have looks illogical since <table> is html, not javascript.
mrowton
Forum Regular

Usergroup: Customer
Joined: Feb 19, 2004
Location: Michigan

Total Topics: 57
Total Comments: 185
mrowton
Posted Apr 06, 2006 - 7:23 AM:

... just the example you have looks illogical since <table> is html, not javascript.

I wanted to use the conditional inside the javascript_export template.

I'm trying to make it easier for users to compose the javascript source url, let them choose the number, type, etc, without me having to provide any technical instructions explaining how the syntax in the url works.

I'm using a form that takes the users options and passes it off to another page that gives the javascript source url in a textarea so that they can copy and paste this into their page (it will also preview the results)

I'm working on it here

Currently users can select the category, number of links, how they want it sorted, etc... That part has been easy because it just adds to the javascript source url.

But I would also like for them to be able to choose options that would change the template. Another example of this would be an option to let them show the description or not.

I'm trying to use

<script language="javascript" src="http://www.domain.com/exporter.php?....&showdescription=yes">
</script>

And then have a conditional in my javascript template that says
<IF {SHOWDESCRIPTION} is yes> {LINKDESCRIPTION}</IF>

I read the manual entry but im either misunderstanding or doing something wrong. Because the above doesn't seem to work.

I know i can call different templates to do this, but would rather not have a template for every option (i have some custom fields that they may want to display)
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Apr 08, 2006 - 8:38 AM:

That has nothing to do with variables and everything to do with the fact that in order to make it faster there is no conditionals syntax (nor any of the other end.php processing stuff) for javascript export.
Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



This thread is closed, so you cannot post a reply.