Author |
Message |
warren-the-ape
Worker
![Worker Worker](modules/Forums/images/ranks/3stars.gif)
![](modules/Forums/images/avatars/5064660247507d6711183.jpg)
Joined: Nov 19, 2007
Posts: 196
Location: Netherlands
|
Posted:
Thu Jan 24, 2008 3:40 pm |
|
Eya guys,
A little question from my side, not sure if i posted this in the correct section, think so
I have a .php page currently located in a custom folder within the modules/ section, which i want to include within a Block to use it at my homepage.
So i thought i do it with an include. Did that before for some custom modules, not a big problem at all (even for a php noobie like me ).
Did not want to do it with an <iframe> cause didnt thought it was necessary and possibly a security risk (?)
Well anyway i created a block which looks something like below;
Code:
$<?php
if (eregi("block-Newblock.php",$_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}
{
OpenTable();
include("modules/folder/file.php");
CloseTable();
}
?>
|
Well you guys probably know better than me, that *nuke needs a '$content' thingie to fill up that block, which i dont use at the moment.
Because of that I now get 2 seperate blocks (understandable cause i open a new table);
1. my included page, looking great
2. block showing the blocktitle + the text 'no text to display', not so great
So my question would be, how would i make this work?
Is it possible to ditch (or override) the $content and perhaps even the block $title ? |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Gremmie
Former Moderator in Good Standing
![](modules/Forums/images/avatars/0cd76dcf45da5de2cf864.jpg)
Joined: Apr 06, 2006
Posts: 2415
Location: Iowa, USA
|
Posted:
Thu Jan 24, 2008 7:37 pm |
|
Well, an ugly way to do this (which the SQuery module does), is to use the CURL library to capture an HTTP request to your .php file and then store that in $content. Yikes.
The better way to do it is to recode your php file so that it contains a function that returns a string, which your file can then call and echo out. Your block can then include the same file and then call the function and capture the result in $content. That might be easier said than done if your file is very complicated. |
_________________ Only registered users can see links on this board! Get registered or login! - An Event Calendar for PHP-Nuke
Only registered users can see links on this board! Get registered or login! - A Google Maps Nuke Module |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
evaders99
Former Moderator in Good Standing
![](modules/Forums/images/avatars/803d73f6452557b947721.jpg)
Joined: Apr 30, 2004
Posts: 3221
|
Posted:
Thu Jan 24, 2008 11:38 pm |
|
You can use output buffering functions to capture the results and return it into $content |
_________________ - Only registered users can see links on this board! Get registered or login! -
Need help? Only registered users can see links on this board! Get registered or login! |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
warren-the-ape
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri Jan 25, 2008 6:14 am |
|
@Gremmie
That page loads a .html template file to define the lay-out and stuff, so it might be possible to stuff some things in there.
I sort of understand what you are saying but i have no idea how to do that (any tutorial somewhere?)
@Evaders99
Ow man you are giving me brain damage I have no idea what 'output buffering functions' are.
It seems its more difficult than i thought, perhaps i should just use an iframe anyway ![Cool](modules/Forums/images/smiles/icon_cool.gif) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
evaders99
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri Jan 25, 2008 2:40 pm |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
montego
Site Admin
![](modules/Forums/images/avatars/0c0adf824792d6d341ef4.gif)
Joined: Aug 29, 2004
Posts: 9457
Location: Arizona
|
Posted:
Sat Jan 26, 2008 5:54 am |
|
Just keep in mind, however, that if this file that you want to include, well, ok, actually its HTML, if you do the output buffering, it is quite possible that the output will have ALL the complete page including <head></head> and <body></body> tags which if then included in a block, could cause you issues (most certainly compliance issues).
I honestly believe you need to hack the code or use an iframe. The best option IMO is to hack the code.
![speedtype](modules/Forums/images/smiles/speedtype.gif) |
_________________ 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! |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
warren-the-ape
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Sat Jan 26, 2008 9:11 am |
|
evaders99, Thnx for the link
I understand some parts of it, and do understand the 1st example they are given but dont really know how to apply it.
montego, Yep I understand but that wont be a problem, cause that page itself doesnt contain any head or body tags.
The page was designed/ment to be included into another (index) page.
Its a standalone script/module i found to manage and display RSS feeds, sort of Multiheadlines but like said standalone and easier to customize.
I tried Multiheadlines but it wasnt really what i wanted, too much locked in within *Nuke itself and not very customizable (is that a word? Loll ).
Ill think i just go for an iframe, but the big downside is that the feedlinks wont be included within the source =spiders miss them on my homepage (yep i know its not very nice to get profit from the content of others but i only display the headlines ) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
warren-the-ape
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Jan 28, 2008 4:01 pm |
|
Sorry for the doublepost, but had to post this.
Man o man o man.. I should have used the Search earlier..
I stumbled upon this topic;
http://www.ravenphpscripts.com/posts14440.html
And noticed the post from Gremmie
Code:<?php
if ( !defined('BLOCK_FILE') ) {
header("Location: ../index.php");
die();
}
$content = file_get_contents('Faux_Pas_Roster.htm');
?>
|
Hehehe loll Gremmie, and a big thnx cause this is working like a charm
The; $content = file_get_contents(''); -that is |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Gremmie
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Jan 28, 2008 8:53 pm |
|
Wow I have no memory of that one. LOL. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
|