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.
Watch
GitHub Core
Show your support for Zikula! Sign up at Github account and watch the Core project!
GitHub Modules
- michiel responded to »password problem« 10:01 AM
- mazdev responded to »Hide "Register new account" and change template to 3 col« 07:50 AM
- mesteele101 created topic »Zikula 1.3.3 - Site Search 1.5.2 - Unable to turn off plug-ins« 07:48 AM
- mesteele101 responded to »ERR (3): E_USER_ERROR: Smarty error: [in pagesvar:pagesitem2en line XXX]…« 25. May
- mazdev responded to »Pages 2.5.0 and updating - Page not found« 25. May
- mesteele101 responded to »Zikula 1.3.3 - Selecting a category in Pages not working« 25. May
- mdee created topic »How to implement returnpage ?« 25. May
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
Problem using javascript in Pagesetter
-
- Rank: Registered User
- Registered: Jan 28, 2008
- Last visit: Oct 21, 2009
- Posts: 45
-
- Rank: Softmore
- Registered: Nov 25, 2007
- Last visit: May 30, 2010
- Posts: 166
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 -
- Rank: Registered User
- Registered: Jan 28, 2008
- Last visit: Oct 21, 2009
- Posts: 45
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. -
- Rank: Softmore
- Registered: Nov 25, 2007
- Last visit: May 30, 2010
- Posts: 166
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 -
- Rank: Registered User
- Registered: Jan 28, 2008
- Last visit: Oct 21, 2009
- Posts: 45
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.
I definitely appreciate any help you can give.
- Moderated by:
- Support
