Webmastersite.net
Register Log In

Javascript Export Usage
Confused about applicability

Comments on Javascript Export Usage

RodrigoDC


Usergroup: Customer
Joined: Jun 29, 2012

Total Topics: 3
Total Comments: 10
Javascript Export Usage
Posted Nov 12, 2012 - 6:53 PM:

Hi Paul,

I seem to be a little confused on the how to utilize the JavaScript export function. I am trying to dynamically create a listing to be shown on portion of my site outside of the WSN Directory section, that is, I want to show a particular listing I have generated on a WordPress installation within my site.

If i understand correctly, here are the steps I need to take:

1. Go to admin > Misc > JavaScript Export
2. On the first text area, I need to enter the previously generated listing (in my case, it is <CONFIG>links[,]title;typeorder[,]5[,]ascending[,]type='premium'[,][,]0[,]0[,]0[,]0[,][,]0[,]0[,]title[,]0[,][,][,]</CONFIG>)
3. On the second text area field, I need to enter the name of the JS I wish to give the particular script. In my case, I named it exactly as biz_of_the_month, without the .js at the end, is this correct? Or should I name it biz_of_the_month.js?
4. Click on Save
5. If desire, I need to go to admin > Templates > Manage Templates > Misc Templates > JavaScript Export and edit the template any way I want to. In my case, I modified it as follows:


<!-- BEGIN TOPLIST 5730 -->
<div class="col-left-featuredbusiness">
<li><CONFIG>links[,]title;typeorder[,]5[,]ascending[,]type='premium'[,][,]0[,]0[,]0[,]0[,][,]0[,]0[,]title[,]0[,][,][,]</CONFIG>
<p><img src="http://downtownwheaton.com/dir/attachments/billys-closet.jpg" alt="Featured Business" width="143" height="80" class="img_left" /></p>
<p class="Captions"><span class="MuseoSans-700-CapsSmaller"><a href="{LINKDETAILSURL}">{LINKTITLE}</a></span><br>
{LINKDESCRIPTION} <a href="{LINKDETAILSURL}">More ></a><br />
<a href="{LINKURL}"target="_blank">{LINKURL}</a><br></p>
</div>
<!-- END TOPLIST 5730 -->


6. Then I need to place the following html code into any page where I want to show the above listing:

<script language="javascript" src="http://mysite.com/dir/javascript/biz_of_the_month.js"></script>


7. and like magic, the listing will appear in the form specified on the template.

Did I get this right? If so, when I add the html JS code on a test html page, nothing is showing up.

Please advice if I got any steps screwed up.

Thanks a bunch, Paul.
Rodrigo
Paul
developer

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

Total Topics: 61
Total Comments: 7867
Paul
Posted Nov 13, 2012 - 8:48 AM:

Your toplist in #5 is illegal, toplists can never have any content between the --> and the <CONFIG> except a newline. Note the config line in the template is irrelevant as what you've entered on the javascript export page will override it, anything legal will work the same.

If you plan to have only one javascript export body content (doesn't matter if you'll have 50 different config lines) then you can edit that template, otherwise if you have 2 or more you should be making a new template instead and specify it in the manner the javascript export page text describes.

You also need to include the .js, it uses the exact filename you tell it to use so you've generated a biz_of_the_month extensionless file.
RodrigoDC


Usergroup: Customer
Joined: Jun 29, 2012

Total Topics: 3
Total Comments: 10
Posted Nov 13, 2012 - 12:01 PM:

Thanks Paul, but I'm a little bit confused with your explanations (please be patient with me).

You say that my toplist in #5 is illegal because no content can be included between the comment tags (-->). Perhaps I'm missing something, but I do not see any content between the comment tags.

The standard JavaScript Export template is as follows:


<!-- BEGIN TOPLIST 1 -->
<CONFIG>links,rating,5,descending</CONFIG>
{NUMBER}) <a href="{LINKDETAILSURL}" target="_blank">{LINKTITLE}</a><br />
<!-- END TOPLIST 1 -->


The template I wish to replace it with also includes some comments, instead of <!-- BEGIN TOPLIST 1 -->, I have <!-- BEGIN TOPLIST 5730 -->. Is that wrong? As the standard template indicates, I open and close the comment tags, then I include my content including the <CONFIG> tag, but it is NOT within the comments.

Anyway, I corrected the second textarea of the JavaScript Export, and named the JS file biz_of_the_month.js. Now, a top list does appear, so I'm on the right track, thanks for pointing that out to me.

However, the toplist that outputs is NOT the toplist I indicated on the first textarea (i.e., <CONFIG>links[,]title;typeorder[,]5[,]ascending[,]type='premium'[,][,]0[,]0[,]0[,]0[,][,]0[,]0[,]title[,]0[,][,][,]</CONFIG>), but instead, it is the one on the standard template (i.e., <CONFIG>links,rating,5,descending</CONFIG>).

My question is, how to I create a JS output that includes the toplist I created (<CONFIG>links[,]title;typeorder[,]5[,]ascending[,]type='premium'[,][,]0[,]0[,]0[,]0[,][,]0[,]0[,]title[,]0[,][,][,]</CONFIG>) in the template I modified?

I am sorry if this is very basic, but either I am very bad at reading instructions, or they are not very clear.

Thanks in advance.
Paul
developer

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

Total Topics: 61
Total Comments: 7867
Paul
Posted Nov 15, 2012 - 3:42 PM:

<!-- BEGIN TOPLIST 5730 -->
<div class="col-left-featuredbusiness">
<li>
<CONFIG>

^ The red part is what's illegal. The <CONFIG> line must immediately follow the toplist declaration on the next line, the red content there breaks the toplist.
RodrigoDC


Usergroup: Customer
Joined: Jun 29, 2012

Total Topics: 3
Total Comments: 10
Posted Nov 27, 2012 - 11:47 AM:

I'm sorry Paul. I just don't don't get it.

Here is my code for my javascript template:

<!-- BEGIN TOPLIST 5730 -->
<CONFIG>links[,]title;typeorder[,]5[,]ascending[,]type='premium'[,][,]0[,]0[,]0[,]0[,][,]0[,]0[,]title[,]0[,][,][,]</CONFIG>
<a href="{LINKDETAILSURL}">{LINKTITLE}</a></span><br>
{LINKDESCRIPTION} <a href="{LINKDETAILSURL}">More ></a><br />
<a href="{LINKURL}"target="_blank">{LINKURL}</a><br>
<!-- END TOPLIST 5730 -->


And yet, every time I run <script language="javascript" src="http://mysite.com/dir/javascript/biz_of_the_month.js"> </script>, the output is always the same, as if nothing is done, namely:

1) Listing X
2) The Wheaton Leader
3) The Pinnacle Planning Group
4) True Cuisine Ltd.
5) AlphaGraphics

Which is NOT the listing I intend to output.

I really must be doing something wrong. Would you mind taking a look at my admin?
Paul
developer

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

Total Topics: 61
Total Comments: 7867
Paul
Posted Nov 27, 2012 - 7:09 PM:

In order to pass custom toplist details to the template it assumes that the toplist is toplist #1 as it is in the standard template. Also I don't believe all possible toplist parameters can be passed -- the most frequent value part I'm pretty sure can't be. So you'd need a custom template for this toplist.

Also note it updates every 12 hours not instantly.

Send me the info and I'll have a look: http://www.wsnlinks.com/inspection.html
RodrigoDC


Usergroup: Customer
Joined: Jun 29, 2012

Total Topics: 3
Total Comments: 10
Posted Nov 27, 2012 - 8:12 PM:

Thanks Paul. Also, the 12 hour is something I have not thought about, so hopefully that will solve the issue. In any event, I have sent you the requested information to access the server.

Thanks again,
Rodrigo
Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



Sorry, you don't have permission to post posts. Log in, or register if you haven't yet.