Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules
Author Message
crabdance
Regular
Regular



Joined: Oct 20, 2006
Posts: 56

PostPosted: Wed Oct 25, 2006 6:14 pm Reply with quote

I need to make a module that when you click on the link it will take you to another php application.

My app is: [ Only registered users can see links on this board! Get registered or login! ]

I need this to come up in a new page. Can anyone help me out with the code? I'm really new at all of this. I did look at some of the other posts about modules but none seemed to address what I am trying to do.

thanks for your help!
 
View user's profile Send private message
hitwalker
Sells PC To Pay For Divorce



Joined:
Posts: 5661

PostPosted: Wed Oct 25, 2006 7:02 pm Reply with quote

huh...
but that doesnt make any sense....
a module to click on a link to take you to another script?

Isnt it better if exactly explain what you want?... Wink
 
View user's profile Send private message
crabdance







PostPosted: Thu Oct 26, 2006 1:35 am Reply with quote

Sorry if I'm not explaining myself well. Let me try this again Smile I want to create something like this:

home
classifieds
downloads
etc.
etc.

this is the left hand column for modules. I don't have a "module" that is "classifieds", I just want to create a directory called "classifieds" in the module directory with one file in it that will take you to the classifieds page (which is located in another sub-directory).

Hope this makes more sense now. I appreciate any help... thanks
 
hitwalker







PostPosted: Thu Oct 26, 2006 4:23 am Reply with quote

But eh modules........?
Let me ask this....
Do you by any chance mean....blocks ?
Cause it doesnt make any sense doing this in a module....
you mean a block?
like you have on the left and right side?
 
montego
Site Admin



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

PostPosted: Thu Oct 26, 2006 6:28 am Reply with quote

Sounds to me like you are wanting/needing to use a more flexible modules block. I personally like Sommaire 2.1.1, although the author has abandoned it. You can get it here if you like.

I have used this version for years. I am also about to embark on making it both XHTML 1.0 and HTML 4.01 compliant (transitional).

_________________
Where Do YOU Stand?
HTML Newsletter::ShortLinks::Mailer::Downloads and more... 
View user's profile Send private message Visit poster's website
crabdance







PostPosted: Thu Oct 26, 2006 7:07 am Reply with quote

YEA!!! it worked. The Sommaire mod was EXACTLY what I wanted!

Thank you so very much for suggesting it. I already have everything working and will not have a hard time trying to do something like this again. Great little module.

again Thanks montego!
 
jazzfuser
Worker
Worker



Joined: Mar 30, 2006
Posts: 111

PostPosted: Thu Nov 09, 2006 3:37 pm Reply with quote

On this same topic, is there an editable block out there, like the editable module that allows you to input HTML and Java within the <!-- start page html --> and
<!-- end page html -->?

I'd like have some rollover buttons in a block for a more custom look.

Thanks!
 
View user's profile Send private message
montego







PostPosted: Fri Nov 10, 2006 5:58 am Reply with quote

For a modules block? I haven't seen it except simply writing your own. Blocks are very easy to create.
 
jazzfuser







PostPosted: Fri Nov 10, 2006 10:41 am Reply with quote

That's what I thought, but here's my attempt at creating a full blown HTML and Java block. I realize I'm missing something very simple to make this work and hopefully can you shed some light on the missing piece of the puzzle.

Quote:
<?php

if ( !defined('BLOCK_FILE') ) {
Header("Location: ../index.php");
die();
}

global $prefix, $db;

$sql = "SELECT pid, title FROM " . $prefix . "_pages WHERE active='1'";
$result = $db->sql_query($sql);
while (list($pid, $title) = $db->sql_fetchrow($result)) {
$pid = intval($pid);
$title = check_html($title, "nohtml");

}
OpenTable();
?>
<!-- start page html -->



<table width="100" border="0" cellpadding="0" cellspacing="0" bgcolor="#0000FF">
<tr>
<td></td>
</tr>
</table>
<!-- end page html --><?
CloseTable();
?>


I couldn't include the java for obvious reasons, but it works. However, when the block is applied live, the content of the block goes outside of the actual block border, and just above it. The Java works (a rollover graphic), but its not confined to the block itself.
 
Gremmie
Former Moderator in Good Standing



Joined: Apr 06, 2006
Posts: 2415
Location: Iowa, USA

PostPosted: Fri Nov 10, 2006 12:15 pm Reply with quote

Read the PHP-Nuke How-To for info on how to create blocks. You probably don't want to call OpenTable or CloseTable. All your block code needs to do is create a string called $content, which will be "pasted" into the block by PHP-Nuke. Thus $content has to contain the HTML and javascript that you want to appear inside the block.

Start from this skeleton and build up on it:
Code:


<?php

if ( !defined('BLOCK_FILE') ) {
Header("Location: ../index.php");
die();
}

$content = "Hello World<br/>This is a test";

?>


Good luck.
 
View user's profile Send private message
jazzfuser







PostPosted: Fri Nov 10, 2006 12:47 pm Reply with quote

It appears adding HTML into blocks, using the $content=" "; will not allow me to simply paste my HTML/Java between the " ". When I do; I lose my pages and only my right blocks and header are displayed. The How To does not cover this, it only gives an example of a hit counter, no java insertion. I plan to refer to a .js file, but I can't even get a simple table tag to stay within the confines of the block at this point. Here's the code from the editable module (which allows you to paste your HTML with no limitations or special PHP relative snytax). There has to be away to do this with blocks...isn't there?

Quote:
<?php
if (!stristr($_SERVER['PHP_SELF'], "modules.php")) {
die ("You can't access this file directly...");
}
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
include("header.php");
$index = 1;
OpenTable();

?>
<!-- start page html -->

<!-- end page html -->
<?

CloseTable();
include("footer.php");

?>
 
Gremmie







PostPosted: Fri Nov 10, 2006 1:53 pm Reply with quote

What you insert in the $content string has to be valid PHP...

I don't understand. If all you have is HTML and javascript, then do this:

Code:


<?php

if ( !defined('BLOCK_FILE') ) {
Header("Location: ../index.php");
die();
}

$content = <<<END_CONTENT
(put all your HTML and javascript here)
END_CONTENT;
?>


For example:
Code:


<?php

if ( !defined('BLOCK_FILE') ) {
Header("Location: ../index.php");
die();
}

$content = <<<END_CONTENT
<table>
<tr><td>Hi Mom</td></tr>
</table>
END_CONTENT;
?>


I have used this technique myself to build simple blocks that consist of nothing but static HTML.
 
jazzfuser







PostPosted: Fri Nov 10, 2006 2:11 pm Reply with quote

That was exactly what I was looking for!! Thanks Gremmie and all.
 
jazzfuser







PostPosted: Fri Nov 10, 2006 5:32 pm Reply with quote

Okay Gremmie, here's another no brainer for you, but stumper for me...

I'm trying to link to my .js file within the block and it's not working using the two methods I'm aware of;

outside of the $content I tried

Quote:
<?
echo"<scri pt type=\"text/ja va scri pt\" language=\"Jav aScr ipt1.2\" src=\"jav ascr ipt/blockdev.js\"></scr ipt>"
?>


then, inside the <<<<<End Content section
Quote:
<scri pt type=\"text/ja va scri pt\" language=\"Jav aScr ipt1.2\" src=\"jav ascr ipt/blockdev.js\"></scr ipt>


Is this possible, or do I have to leave the java within the content in regard to blocks?
 
Gremmie







PostPosted: Fri Nov 10, 2006 6:31 pm Reply with quote

You don't have to escape double quotes like that inside a hereto document (the <<< thingy). Did you try it without the \'s (backslashes) inside the <<< section?
 
jazzfuser







PostPosted: Fri Nov 10, 2006 7:28 pm Reply with quote

I just hate being a newb...*sigh*

Yes, taking out the \" worked just fine.

Thank you for your help, and for being so polite in the face such stupidity.
 
Gremmie







PostPosted: Fri Nov 10, 2006 9:50 pm Reply with quote

I was a newbie just a few months ago. It's all about helping each other... Cheers
 
jazzfuser







PostPosted: Fri Nov 10, 2006 10:10 pm Reply with quote

here here! Cheers
 
jazzfuser







PostPosted: Sat Nov 11, 2006 1:27 am Reply with quote

Okay, I'm still here in newbville. All is well regarding functionality...(thanks again), the problem now is when the page is not pointed to index.php the java ceases to function.

For example, you load the site and the java works, you click on the forums and roll your cursor over the rollover graphics in the block on the left and nothing happens, press Home via the logo or other basic source of navigation and get back to index.php then the rollovers function again.

Does this have anything to do with the
Quote:
Header("Location: ../index.php");


Perhaps I need some sort of global reference for it to work when viewing other modules other than the root index.php?
 
montego







PostPosted: Sat Nov 11, 2006 6:46 am Reply with quote

If you use the default theme of DeepBlue, does it do the same thing?
 
jazzfuser







PostPosted: Sat Nov 11, 2006 10:11 am Reply with quote

I just tried deepblue and it has the same result.
 
montego







PostPosted: Sat Nov 11, 2006 5:53 pm Reply with quote

Unfortunately, I have not tried to do this, so am not sure where the problem lies. I have a feeling the clue may be in that when you are in forums, the relative pathing may not be correct. Try using src="/javascript/blockdev.js" instead of what you have or the full URL to it (i.e., including your domain).
 
jazzfuser







PostPosted: Sat Nov 11, 2006 6:09 pm Reply with quote

Thank you!
 
montego







PostPosted: Mon Nov 13, 2006 6:50 am Reply with quote

So it worked then?
 
jazzfuser







PostPosted: Mon Nov 13, 2006 10:26 am Reply with quote

As things started coming together I changed the .js file name. Except I forgot to change the name in my dev templete, so when I made the changes to the syntax I forgot to change the .js filename. So I pasted the old tag with the old .js name which did not have all the java applied to it, thus limited functionality. I changed it to its proper name in the final block file to main.js and it works from all pages, just as it would have from Gremmie's example. Your post, Montego, forced me to examine the script tag and that's where I caught it. Hence the "Thank you!"...

Again, thank you!
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules

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 ©