Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks
Author Message
warren-the-ape
Worker
Worker


Joined: Nov 19, 2007
Posts: 196
Location: Netherlands

PostPosted: Thu Jan 24, 2008 3:40 pm Reply with quote

Eya guys,
A little question from my side, not sure if i posted this in the correct section, think so Wink

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 Wink).
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 Razz
2. block showing the blocktitle + the text 'no text to display', not so great Sad

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 ?
 
View user's profile Send private message
Gremmie
Former Moderator in Good Standing


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

PostPosted: Thu Jan 24, 2008 7:37 pm Reply with quote

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 
View user's profile Send private message
evaders99
Former Moderator in Good Standing


Joined: Apr 30, 2004
Posts: 3221

PostPosted: Thu Jan 24, 2008 11:38 pm Reply with quote

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! 
View user's profile Send private message Visit poster's website
warren-the-ape
PostPosted: Fri Jan 25, 2008 6:14 am Reply with quote

@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 Laughing (any tutorial somewhere?)

@Evaders99
Ow man you are giving me brain damage Crying or Very sad 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
 
evaders99
PostPosted: Fri Jan 25, 2008 2:40 pm Reply with quote

I know code has already been posted, but this function should help get you started Only registered users can see links on this board! Get registered or login!
 
montego
Site Admin


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

PostPosted: Sat Jan 26, 2008 5:54 am Reply with quote

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

_________________
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! 
View user's profile Send private message Visit poster's website
warren-the-ape
PostPosted: Sat Jan 26, 2008 9:11 am Reply with quote

evaders99, Thnx for the link Smile
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 Very Happy).


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 Wink)
 
warren-the-ape
PostPosted: Mon Jan 28, 2008 4:01 pm Reply with quote

Sorry for the doublepost, but had to post this.

Man o man o man.. I should have used the Search earlier.. Embarassed

I stumbled upon this topic; Only registered users can see links on this board! Get registered or login!


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 Cool worship
The; $content = file_get_contents(''); -that is
 
Gremmie
PostPosted: Mon Jan 28, 2008 8:53 pm Reply with quote

Wow I have no memory of that one. LOL.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks

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 ©