Hi all!
Im a newbie at this php and am keen to learn more! I'm currently re-hashing my website to include some portfolio work and would like to pull some content into an iframe.
Here's my set-up:
I have an includes.php with all files to include
All text is stored in one file and consists of a bunch of text declarations like so:
// alltext.php Define text
define("REFNAME1", "text and any html tags here");
define("REFNAME2", "text and any html tags here");
define("REFNAME3", "text and any html tags here");
define("LISTOFLINKS", "<ul>
<li><a href='index.php?text1'>link 1</a></li>
<li><a href='index.php?text2'>link 2</a></li>
<li><a href='index.php?text3'>link 3</a></li>
</ul>");
another file contains the variables and 'displays' for the content and looks like:
// displayclasses.php
// set new class
class Page_options {
// Get variable
var $var_1;
var $var_2;
var $introvar;
// Displays correct text according to URL
function display_options($varref_one, $varref_two, $introvar) {
if(isset($this->var_1)) {
echo $varref_one;
}
elseif(isset($this->var_10)) {
echo $varref_two;
}
else {
echo $introvar;
}
}
}
and on my main pages I marry the two to pull the various texts onto the page for viewing:
// index.php
< ?php
include_once("../includes.php");
$index = new Page();
$all_options = new Page_options();
$all_options->ver_1 = $GET['text1'];
$all_options->var_2 = $GET['text2'];
$all_options->introvar = $_GET['text3'];
?>
Then further down, I echo and set the texts for displaying:
<div>
<?php echo (LISTOFLINKS); ?>
<?php $all_options->display_options(REFNAME1, REFNAME2, REFNAME3); ?>
so when the user clicks any link listed in the LISTOFLINKS defined text, the appropriate text from the alltexts.php appears.
However I wish to take some of the rather long pieces of text and place them into an iframe.
I tried:
<iframe src="<?php $all_options->display_options(REFNAME1, REFNAME2, REFNAME3); ?>">
But this gave me either:
Not Found
The requested URL /web/sinful/CW/text and any html tags here. was not found on this server.
Apache/1.3.33 Server at local Port 80
or
Forbidden
You don't have permission to access /web/sinful/CW/text and any html tags here. on this server.
Apache/1.3.33 Server at local Port 80
so I am stuck! Can anyone please help me out?
I can see that by the path of the error messages, it is not finding the variable but a file. I got this snippet of code from another forum y'see when trying to solve this problem! I know it's wrong, but it was the closest I could get! I though I could jiggle the code, but I'm at a loss!
I've read about POSTing to iframes etc, but with this setup I am unsure how!
Anyways, many many many thanks in advance!
Best,
rach