Author |
Message |
emmaphp
Worker
Joined: Aug 22, 2006
Posts: 192
|
Posted:
Sun Sep 17, 2006 7:07 pm |
|
I wonder if someone may be able to assis me in solving this problem of trying to intergrate some Javascript into a block.
I am trying to use a calendar ( located at the following URL http://www.javascriptkit.com/script/script2/epoch/index.shtml ) and intergrate it into a side block on my Raven Nuke 76 website.
The problem I have is that although I can make the calendar work in a regular HTML page, some of the scripts go in the header of the page and I do not know how to intergrate all this in my phpnuke website.
After browsing the raven forums I have begun to think that I may need to add some script to the includes/javascript.php file, but agin I have no clue how to modify this or what code I should be placing in the file.
Any help would be greatly appreciated. |
Last edited by emmaphp on Wed Sep 20, 2006 8:59 am; edited 2 times in total |
|
|
|
Nukeum66
Life Cycles Becoming CPU Cycles
Joined: Jul 30, 2003
Posts: 551
Location: Neurotic, State, USA
|
Posted:
Mon Sep 18, 2006 5:42 am |
|
I would create a file for the head code and include it in the header.php file
1. save the head code as cal.php and place it in the includes folder
2. open the header.php and just under
include("includes/javacript.php");
add
include("includes/cal.php"); |
_________________ Scott Johnson MIS Ubuntu/Linux 11.10 |
|
|
|
montego
Site Admin
Joined: Aug 29, 2004
Posts: 9457
Location: Arizona
|
Posted:
Tue Sep 19, 2006 6:04 am |
|
Just an alternative that I personally prefer, especially given the release of PHP-Nuke you are on, is to use a "custom_head.php" file. Under your includes directory you should have a sub-directory called "custom_files". Underneath that, place a new php script file called "custom_head.php" and place any code there that generates HTML which needs to go between the HEAD tags.
The reason I like this better is that I don't have to be concerned about overwritting my core nuke files with every patch release. |
_________________ Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! |
|
|
|
emmaphp
|
Posted:
Tue Sep 19, 2006 7:27 am |
|
Thanks for your replied Nukeum66 & Montego.
Montego I personally prefer your solution (if it does indeed work), for exactly the same reason as you stated.
Please can you advise me how the code in the new (custom_head.php) file should be written? I mean, what is the 'core' code to be placed in the file other than the specific java script code I will be including?
Can you give me an example etc?
Your time is much appreicated.
Below I was going to include the script/code from the original header, but I was blocked from doing so... |
|
|
|
|
montego
|
Posted:
Wed Sep 20, 2006 6:12 am |
|
Quote: |
if it does indeed work
|
I am hurt...
Here is a sample that I have working on my 2.02.02 site:
Code:
<?php
/************************************************************************/
/* PHP-NUKE: Web Portal System */
/* =========================== */
/* */
/* Copyright (c) 2004 by Francisco Burzi */
/* http://phpnuke.org */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/************************************************************************/
/******************************************************************************
* Rev Date ID Description
* ----------- -------- -----------------------------------------------------
* 10-FEB-2006 N/A Adding CSS link for HTML Newsletter
* 19-JAN-2006 MS_037 Adding CSS statements for RWS CollapsingForums block
******************************************************************************/
if (stristr(htmlentities($_SERVER['PHP_SELF']), "custom_head.php")) {
Header("Location: ../index.php");
die();
}
/*
This file is to customize whatever stuff you need to include in your site
when the header loads. This can be used for third party banners, custom
javascript, popup windows, etc. With this file you don't need to edit
system code each time you upgrade to a new version. Just remember, in case
you add code here to not overwrite this file when updating!
Whatever you put here will be between <head> and </head> tags.
*/
//MS_037:BEGIN
// BEGIN - Add style sheet for collapsing forum block
echo <<<_JS_
<s-tyle type="text/css">
<!--
#listbutton{
border:1px solid #4B4B4B;
background-color:#F3F3F3;
width:60px;
height:12px;
font: normal 11px Arial, Verdana, Helvetica, sans-serif;
text-align:center;
cursor:pointer;cursor:pointer;
vertical-align:top;
}
.expandhighlight, .expandhighlight a{
color:red;
}
-->
</s-tyle>
_JS_;
// END - Add style sheet for collapsing forum block
//MS_037:END
//Added HTML Newsletter 1.3 style sheet
echo "\n<link rel=\"stylesheet\" href=\"themes/$ThemeSel/style/msnl_style.css\" type=\"text/css\">\n";
?>
|
Of course, I have modified a few of the tags to avoid triggering NukeSentinel.
In this example, I am using the HEREDOC format echoing out the raw HTML/js. You could also write out each line separate with echo 'your code'; if you prefer. |
|
|
|
|
emmaphp
|
Posted:
Wed Sep 20, 2006 9:47 am |
|
Montego thanks for this fuirther very helpful reply, however I am still having problems.
I assume you had a look at the url I gave at the begining of this thread and understand exactly what I am trying to aacheive here and the type of block I am trying to create, (i.e. this event calendar).
Howeve the problem I now face is that the original HTML Body code has something called an ID, (which I am not familiar with), and this is referenced to the code that was originally required in the header.
Well now I have removed the header code to the includes/custome_header.php file, I do not know how to reference the ID code to the Java Script code.
Below is a copy of the code so you can see what I mean, (although it is also available via the top link I gave).
Please can you asssist further?
Original code....
<HT ML>
<HE AD>
<TI TLE>My Website</TI TLE> <ME TA HT TP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<link rel="sty lesheet" type="text/css" href="epoch_styles.css" />
<scri pt type="text/javascript" src="epoch_classes.js"></scri pt>
<scri pt type="text/javascript">
/*You can also place this code in a separate file and link to it like epoch_classes.js*/
var bas_cal,dp_cal,ms_cal;
window.onload = function () {
bas_cal = new Epoch('epoch_basic','flat',document.getElementById('basic_container'));
dp_cal = new Epoch('epoch_popup','popup',document.getElementById('popup_container'));
ms_cal = new Epoch('epoch_multi','flat',document.getElementById('multi_container'),true);
};
</scri pt>
</HE AD>
<BO DY BGCOLOR="#FFFFFF" TEXT="#000000">
<DIV ALIGN="CENTER"><TABLE WIDTH="134" BORDER="0" CELLSPACING="0" CELLPADDING="0" HEIGHT="200"><TR><TD VALIGN="TOP" ALIGN="CENTER" BGCOLOR="#FF0000"><div id="basic_container"></div></TD></TR></TABLE></DIV>
</BO DY>
</HT ML> |
|
|
|
|
|