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
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

Link to comment
Share on other sites

Nope, it still just includes main.php without the recent images block I'm afraid, as if it was including main.php rather than main.php?imageblock.External&g2_blocks=recentImage|recentImage|recentImage|&g2_show=title

 

Thanks for the help so far

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.