Always look for the error (when it comes to javascript):
Error: toggleFolderView is not defined
Source File: javascript:toggleFolderView('nbMi72')
Line: 1
I see this (in Firefox) when clicking on your javascript links. Check your js code; the quotemarks in it are being converted to numeric character references (for “pretty” single-quotes: ‘ and ’), and this is playing havoc with it’s functionality.
Question: Can you move your javascript function into your <head>? That’s really where it belongs.
Thread Starter
mrmac
(@mrmac)
Hi Kafkaesqui and thank you for the support.
Thanks to your suggestions I began to better understand what’s up with the script and – above all – I understood how to make a deeper diagnosys in the future on similar problems.
Yet, my programming skills are a bit rusty (does it says anything “turbopascal v.3.0”?) 😉
I managed to locate the text of the script (here below) but I have no clue on how to fix the problem. I’m even unaware if having the text of the scripts itself can allow you (or anybody else) to support me (however I try!).
Concerning your question, for the little knowledge I developed of WP in these past two weeks, I believe that it’s impossible to move the JS to the head part of the page: the script is inserted via a php call in the actual text of the post/page (XBEL plugin)… if you have suggestions – however – I will be glad to try them out.
<script language=”JavaScript”>
function toggleFolderView(szDivID)
{ var obj = document.layers ? document.layers[szDivID] : document.getElementById ? document.getElementById(szDivID).style : document.all[szDivID].style; obj.display = (obj.display == ‘none’ ? ‘block’ : ‘none’); var obj_title = document.layers ? document.layers[szDivID+’_title’] : document.getElementById ? document.getElementById(szDivID+’_title’).style : document.all[szDivID+’_title’].style; obj_title.backgroundImage = (obj_title.backgroundImage == ‘url(<?=$folder_open?>)’ ? ‘url(<?=$folder_closed?>)’ : ‘url(<?=$folder_open?>)’); }</script>
Many thanks!
Mac.
“the script is inserted via a php call in the actual text of the post/page”
Yes, it would be inserted with the help of the wp_head hook, which should be in the <head> of your template (usually header.php). However, your Page source shows the javascript (above) is appearing in the <body> of your document, just before your bookmark links actually begin. So the question is, how is the plugin able to add the javascript in this portion of your Page?
Another question is how the quotes are being converted, but I suspect if we can answer the first, the second will be dealt with.
Actually, I took a closer look at this plugin, and the only element being inserted *automatically* is the stylesheet link. The js is added as part of the xbel() function. Are you calling this function within a Page template, or rather somehow from its content (i.e. Write/Manage > Pages)?
Thread Starter
mrmac
(@mrmac)
The procedure I followed is the one described by the author of the plugin: I inserted the following snippet of code
<?php xbel(); ?>
in the editor window of Write/Manage. In order to process it I installed EZstatic plugin, but I also tried (and got the same problems) with “the execution of all things” and some other plugin who is supposed to execute pieces of code…
Does this help to help? 🙂
Either WordPress or a text formatting plugin is converting the quotes when handling the Page content. Without doing some digging I can’t say what to change to fix this, but I can suggest another method to incorporate it into your Page:
1. Make a copy of your theme’s page.php template, and call it bookmarks.php.
2. Edit bookmark.php in a text editor (or your WordPress Theme Editor). First, add this to the very top of it:
<?php
/*
Template Name: Bookmarks
*/
?>
Then right after The Loop portion of your template (or within it but after the_content()), add:
<?php xbel(); ?>
3. Go to Manage > Pages, edit My Bookmarks, and select “Bookmarks” from the Page Template dropdown list (then click Edit Page).
More information on Page templates:
http://codex.wordpress.org/Pages#Page_Templates
Thread Starter
mrmac
(@mrmac)
Kudos to you, Kafkaesqui, for having found a perfect solution for what I needed to do. Now the page works exactly as I wanted… Moreover I learnt different useful things along the way… hope I will be able to support others in the future!
http://lxp.it/index.php/my-bookmarks/