Jump to content

PHP Includes & Passing Variables


cianclarke

Recommended Posts

What I want to do is the following:

 

<?php

include 'http://www.cianclarke.com/gallery/main.php?g2_view=imageblock.External&g2_blocks=recentImage|recentImage|recentImage|&g2_show=title';

?>

However this doesn't work with dreamhost, as they won't allow http:// in the include - ie no remote includes (even though in this case it's actually local)...

 

So instead I tried this:

 

<?php

include 'gallery/main.php';

$g2_view=imageblock.External;

$g2_blocks=recentImage|recentImage|recentImage|;

$g2_show=title;

?>

 

However this still doesn't work - it just displays main.php, and doesn't seem to include the above. I also tried using cURL (some copy-pasted code which I didn't understand, needless to say this didn't work).

 

So, what I'm trying to do is include this page:

http://www.cianclarke.com/gallery/main.php?g2_view=imageblock.External&g2_blocks=recentImage|recentImage|recentImage|&g2_show=title

 

Can anybody tell me how I do this in PHP - I need to be able to pass these variables so they work.

It might also be worth mentioning I'm trying to do this in Joomla on a static page in the WYSIWYG TinyMCE, however I'll worry about the problems this presents when I get to this stage!

Thanks

Link to comment
https://forums.phpfreaks.com/topic/45131-php-includes-passing-variables/
Share on other sites

The include statement is used to include PHP statements into your script, when you try to include a file referenced by a URL, the only thing that will be included is the output of the script -- usually not what you intended.

 

Did you try:

<?php
$g2_view=imageblock.External;
$g2_blocks=recentImage|recentImage|recentImage|;
$g2_show=title;
include 'gallery/main.php';
?>

 

Ken

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.