Fork me on GitHub

Problem using javascript in Pagesetter  Bottom

  • Hi all,

    I am in the process of moving all of my site content from the subjects module to the Pagesetter module. All content pages are coded in HTML and some include javascript as well. I have found that the pages where I have used javascript (mainly for popup windows, though a collapsible divs script is not working either.) do not transfer over to Pagesetter properly. Is there a way around this? Has anyone else had this problem using javascript inside Pagesetter?

    Thanks for your help.
  • The problem is probably caused by the fact that your HTML settings (look in Admin / Settings) don't allow the script tag with attributes. You have a couple solutions:

    1. Allow the script tag with attributes. Probably not a great idea because it would allow users to use javascript in user-submitted content (comments, etc.).

    2. Strip the javascript out of the page content and place it into the template for the appropriate document type instead.



    --
    Help Now! Fast and affordable help for do-it-yourself webmasters from Wicked Viral :: Chicago's Only Web Development Firm Specializing in Social Networking Integration
  • Thank you for your response. Unfortunately, that didn't fix it for me. There was no problem with allowing the script tag with attributes as this is an intranet site for the company I work for and there are no user accounts. As far as removing the javascript from the pages and placing it in the template, the javascript on each page is specific for that page so I can't add just one universal code into the template. Are there any other solutions that you know of? I really don't want to keep a small amount of content in a separate module, and am hoping a way can be found to resolve this.
  • I have a few ideas, but I need to know exactly what you're trying to accomplish. Does every page really have its own unique Javascript or is it pretty much the same script with a few attributes that are unique to each page? Is the source of the script on the page itself or in external (.js) files?

    The solution is probably to create another document type specifically for javascript. As for how to structure the document type, create the templates, and relate it to your main content documents, that would depend on the answers to the questions above.

    For example, I have created a couple sites where instead of my client paying me for site development and maintenance, I rotate my own Google Ads and affiliate ads in with the client's ads. Her ads show 70% of the time, mine 30% of the time. The ads themselves are, of course, Javascript. The src= attribute for each is stored within a Pagesetter document and the template of the main document does a little math, determines whose ads to show, and then does something along the lines of pnmodfunc modname=Pagesetter func=viewpub tid=7 pid=$whichadtoshow where the full template for tid7 looks something like:

    Code

    script type="text/javascript" src="<!--[$scriptsrc]-->" />




    edited by: dreamingmonkey, Jul 15, 2008 - 04:30 PM

    --
    Help Now! Fast and affordable help for do-it-yourself webmasters from Wicked Viral :: Chicago's Only Web Development Firm Specializing in Social Networking Integration
  • Hi thanks for the reply.

    Quote

    Does every page really have its own unique Javascript or is it pretty much the same script with a few attributes that are unique to each page?

    Many pages use the same essential script, but with different variables. Several key pages to the site use their own scripts though.

    Quote

    Is the source of the script on the page itself or in external (.js) files?

    The script is in the page itself, not linking to an external file. Do you think that will make a difference? May be something to try...

    Quote

    The solution is probably to create another document type specifically for javascript. As for how to structure the document type, create the templates, and relate it to your main content documents

    I use the floating "related links" div in my PS-StaticContent templates which is a required feature for the client. By creating a new document type, would that mean that the content would no longer be in the appropriate PS-StaticContent category?

    Thank you for taking the time to respond to my questions. While I'm not a total newb with HTML and PHP, javascript and Smarty tags make me want to tear my hair out. icon_razz I definitely appreciate any help you can give.

This list is based on users active over the last 60 minutes.