displaying a php file inside a div.
Moderator: General Moderators
displaying a php file inside a div.
Hello everyone.
I have a slight problem. I am about 3 months new to php coding and am requesting an answer to the following.
Bascially i have php link that should display a php file within a div.
2 php files are being used. one as the index the other as the file to be loaded into the div i created.
This is the php code - index.php. this code is inside php start and finish conditions.
<a href=view_subCat.php?cat_Id=$cat_Id target= content><font size='2' color='#0066FF'>"."$cat_Name"."</font></a>
This is the div where the view_subCat.php file need to be loaded - index.php - this code does not exist inside php start and close conditions
<div id="content" style="position:absolute; top:50; left:0; width:200; height:648; z-index:1; border: #000000 1px solid;background-color:none;"></div>
At the moment it is loading the view_subCat.php file in full view rather then inside the div i created. The div has an id called content that i use as a target. I have also tried
rel. However, after using either rel or target, the file loads the php in a new window or loads the file in full view of the index page where the div is coded.
Is there anything i can do to make sure it loads within the div's only?
I have a slight problem. I am about 3 months new to php coding and am requesting an answer to the following.
Bascially i have php link that should display a php file within a div.
2 php files are being used. one as the index the other as the file to be loaded into the div i created.
This is the php code - index.php. this code is inside php start and finish conditions.
<a href=view_subCat.php?cat_Id=$cat_Id target= content><font size='2' color='#0066FF'>"."$cat_Name"."</font></a>
This is the div where the view_subCat.php file need to be loaded - index.php - this code does not exist inside php start and close conditions
<div id="content" style="position:absolute; top:50; left:0; width:200; height:648; z-index:1; border: #000000 1px solid;background-color:none;"></div>
At the moment it is loading the view_subCat.php file in full view rather then inside the div i created. The div has an id called content that i use as a target. I have also tried
rel. However, after using either rel or target, the file loads the php in a new window or loads the file in full view of the index page where the div is coded.
Is there anything i can do to make sure it loads within the div's only?
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Not sure if this is what you are after but take a look: http://www.dynamicdrive.com/dynamicinde ... viewer.htm
Re: displaying a php file inside a div.
The attribute "target" of anchor element must be the name of some window.jwaqa1 wrote:Hello everyone.
<a href=view_subCat.php?cat_Id=$cat_Id target= content><font size='2' color='#0066FF'>"."$cat_Name"."</font></a>
In your case, use Ajax to get information from server and use DOM to fill div block
feyd | Please use
Try replace iframe with div ? It's OK?
feyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
If you don't like Ajax, use iframe
[syntax="html"]<a href="javascript:document.getElementById('content').src='view_subCat.php?cat_Id=$cat_Id'"><font size='2' color='#0066FF'>"."$cat_Name"."</font></a>
<iframe id="content" style="position:absolute; top:50; left:0; width:200; height:648;border: #000000 1px solid;background-color:none;"></iframe> feyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]For an iframe, instead of "id" you need to use "name" to reference it as a target.lnt wrote:If you don't like Ajax, use iframeTry replace iframe with div ? It's OK?Code: Select all
<a href="javascript:document.getElementById('content').src='view_subCat.php?cat_Id=$cat_Id'"><font size='2' color='#0066FF'>"."$cat_Name"."</font></a> <iframe id="content" style="position:absolute; top:50; left:0; width:200; height:648;border: #000000 1px solid;background-color:none;"></iframe>
So if you're going to use the above javascript with getElementById() keep it id="content" but if you want to use your original code of target="content" you need to make it name="content".
Thankyou
Its working fine now Thankyou.
I modified my html file to use iframes.
Bascially i modified and used code from the http://www.dynamicdrive.com/dynamicinde ... viewer.htm example.
the following php code tells the javascript tabs to load the php files into the iframes.
<ul id="tablist"> print("<li><font color='#0066FF'><a class='current' href=view_subCat.php?cat_Id=$cat_Id onClick='return handlelink(this)'>"."$cat_Name"."</a></font></li>");</ul>
The Pages are loaded into the following iframe
<iframe id="tabiframe" src="sub Categories.htm" width="10%" height="80%"></iframe>
regards jwaqa1
I modified my html file to use iframes.
Bascially i modified and used code from the http://www.dynamicdrive.com/dynamicinde ... viewer.htm example.
the following php code tells the javascript tabs to load the php files into the iframes.
<ul id="tablist"> print("<li><font color='#0066FF'><a class='current' href=view_subCat.php?cat_Id=$cat_Id onClick='return handlelink(this)'>"."$cat_Name"."</a></font></li>");</ul>
The Pages are loaded into the following iframe
<iframe id="tabiframe" src="sub Categories.htm" width="10%" height="80%"></iframe>
regards jwaqa1
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London