Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> phpnuke 7.8
Author Message
Fionavar
New Member
New Member



Joined: Nov 03, 2005
Posts: 6

PostPosted: Wed Nov 02, 2005 11:09 pm Reply with quote

I found that Raven kindly helped with this question sometime ago here: [ Only registered users can see links on this board! Get registered or login! ]

As I am a newb with PHP-Nuke and I am trying to learn everything I hope you will be patient with me. The following is what I posted over @ Nuke Cops:

Quote:
I have a DHTML menu in a java script with an image.

These are the files I have:

051102.js
spiral.gif

I want to insert this menu into a custom block I have made. Currently called: Test.

So if someone could gently guide me through exactly what I need to do I would be most appreciative. Where do the files go? Where does the code go - into the Block text itself? And if I have to create a file, what is it and what does it need to contain? I am grateful for any assistance.
 
View user's profile Send private message
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17087

PostPosted: Wed Nov 02, 2005 11:28 pm Reply with quote

Assuming you have a standard block configuration, you could do something as simple as this. Place the 051102.js file in your includes/ folder and place the spiral.gif in your images/blocks/ folder. Then just code something like this.
Code:
<?

if (!defined('BLOCK_FILE')) { die("Illegal File Access Detected!!"); }
$content = "";
include("includes/051102.js"); // Include the java script
// The rest of your block code
?>
 
View user's profile Send private message
Fionavar







PostPosted: Thu Nov 03, 2005 12:09 am Reply with quote

Ok that sort of makes sense to me - so endure the following as I try to figure it out Confused

The current block - Test - is one that I have created through the PHP-Nuke 'Add a New Block' function. I have not manually done it - per se. So ... are you talking about me modifying the code of the block itself or inserting the code in the text into the Content box from the Block Admin panel - does that make sense?

PS Thanks for your response and the patience I may test in trying to get this to work!
 
Raven







PostPosted: Thu Nov 03, 2005 12:17 am Reply with quote

You cannot use the Content box facility for blocks with PHP code. That is only for HTML. So, your block must reside in the blocks folder of your site.
 
Fionavar







PostPosted: Thu Nov 03, 2005 12:23 am Reply with quote

Ok that makes more sense. So the following question will only reinforce that I am rather ignorant. I do not see a 'test.php' or anything of that sort to indicate the block I have created through PHP-Nuke. This in turn makes me more uncertain as to where I should insert code (i.e. where is the 'rest of your block code' to be found?). Does that make sense?

If I create a block - where in fact is the block info? As well, once I - hopefully - figure this out - will changing themes alter this code? The reason I ask is that once I have figured out how to make the DHTML code live, I want to find a theme-editor to help with the layout. So making sure that I am not creating more work without a decided upon theme is also a consideration.
 
Raven







PostPosted: Thu Nov 03, 2005 12:31 am Reply with quote

You say you have created a custom block named test. You need to make the name block-test.php and place it in your blocks folder. The code skeleton that you would use is in my first post.
 
Fionavar







PostPosted: Thu Nov 03, 2005 12:34 am Reply with quote

Ok I think I follow that. When you say in the code part of your first post:

Quote:
// The rest of your block code


Is there something I actually need to insert? If so, what?
 
Fionavar







PostPosted: Thu Nov 03, 2005 5:32 pm Reply with quote

Ok here is what I have at the moment ( I sort of used the code from the Content.php Block. I thought I had made the necessary changes, but still no Menu visible. I am feeling close however Wink

Quote:
<?php


if (!defined('BLOCK_test')) { die("Illegal File Access Detected!!"); }
$content = "";
include("includes/051102.js"); // Include the java script
//
if (eregi("block-test.php", $_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}

global $prefix, $db;

$result = $db->sql_query("SELECT pid, title FROM " . $prefix . "_pages WHERE active='1'");
while ($row = $db->sql_fetchrow($result)) {
$pid = intval($row['pid']);
$title = stripslashes($row['title']);
$content .= "<strong><big>&middot;</big></strong>&nbsp;<a href=\"modules.php?name=content&amp;pa=showpage&amp;pid=$pid\">$title</a><br>";
}

?>


So is there something in here that I need to corret? The file's name is block-test.php
 
Raven







PostPosted: Fri Nov 04, 2005 8:55 am Reply with quote

First of all, change
Code:
if (!defined('BLOCK_test')) { die("Illegal File Access Detected!!"); }
to
Code:
if (!defined('BLOCK_FILE')) { die("Illegal File Access Detected!!"); }

That's a constant, not a variable.

Next, you have included the *.js file but you are not referencing it anywhere.
 
Fionavar







PostPosted: Fri Nov 04, 2005 10:16 am Reply with quote

Thanks Raven - another ignorant question on my part: What do you mean by referencing? Where would I do that?
 
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Fri Nov 04, 2005 3:44 pm Reply with quote

This may be an incredibly stupid question, but doesn't the variable $content have to have either the java~script statements added to it or a script tag? I.e., either the .js statements need to be brought in to be in-line within the $content variable or a script reference tag needs to bring it in browser-side.

_________________
Where Do YOU Stand?
HTML Newsletter::ShortLinks::Mailer::Downloads and more... 
View user's profile Send private message Visit poster's website
Display posts from previous:       
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> phpnuke 7.8

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©