Hello All,
I have been unsuccessfully trying to place a javascript drop-down menu into my PN Theme. The goal is to eliminate the need for the menu block and thus fre up more space. Yet for the life of me I can't seem to get the darn manu to work!? Can anyone point me to some info about this? Can this be done (javascript inside PHP?)
Thanks
Watch
GitHub Core
Show your support for Zikula! Sign up at Github account and watch the Core project!
GitHub Modules
- mesteele101 created topic »Pages 2.5.0 and updating - Page not found« 05:20 AM
- mesteele101 responded to »ERR (3): E_USER_ERROR: Smarty error: [in pagesvar:pagesitem2en line XXX]…« 05:05 AM
- mesteele101 responded to »Zikula 1.3.3 - Selecting a category in Pages not working« 01:29 AM
- mdee created topic »How to implement returnpage ?« 01:00 AM
- nestormateo responded to »Fillters in Clip« 24. May
- damon responded to »Can the Updated Version Check be Turned Off (Z 1.3)« 24. May
- frw responded to »Bug in the SMTP mail transfer protocol - Port 25 - Zikula 1.2.9« 22. 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
Javascript Menu inside theme?
-
- Rank: Softmore
- Registered: May 22, 2004
- Last visit: Apr 03, 2010
- Posts: 451
-
**unknown user**
- Rank: Softmore
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 216
Outputting JavaScript to the browser is no different to PHP than outputting HTML to the browser. So it's no problem, it can be done.
If you don't want to "roll your own" and do it yourself, there is a really slick package (see this thread), DynaMenu, that you can do this with. -
**unknown user**
- Rank: Softmore
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 365
Rem,
It is real easy to do with an AutoTheme. I've done it with a PHP theme, but I think I had to edit the head code javascript in the the header.php file, but I can't really remember for certain. Its been that long since I bother with a PHP theme. -
**unknown user**
- Rank: Helper
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 676
I haven't had any trouble putting Javascript into themes. It depends on the script where it needs to go. If it needs to go in the Head, as some do, you put it just after the themeheader. For example:
As mentioned, any code embedded in Echo statements must have double-quotes escaped with \"Code
function themeheader() {
global $thename, $index, $bgcolor1, $bgcolor2;
$slogan = pnConfigGetVar('slogan');
$sitename = pnConfigGetVar('sitename');
$banners = pnConfigGetVar('banners');
$username = pnUserGetVar('uname');
// Place any HEADer information here, like Javascript, using echo and escaping double-quotes with \"
echo "<script language=\"JavaScript\">
<!--
function toggleMenu(bid){
var blockID = document.getElementById ? document.getElementById(bid) // Dom
: document.all ? document.all[bid] // ie4
: null; // unsupported
if (blockID == null) return;
if (blockID.style.display==\"none\")
blockID.style.display=\"\"
else
blockID.style.display=\"none\"
}
//-->
</script>\n";
echo "</head>\n";
?>
<BODY>
There are some themes which don't have the closing tag, but it should be there.
- Moderated by:
- Support
