|
mindpetrol
|
 |
« on: December 07, 2008, 02:57:22 AM » |
|
I want to have the panels on the left and right side of my pages to be the same no matter what part of the site you visit. Is there a way I can set the panels up like widgets so that when I change them in one location they change on all the pages? Because it would be a real headache to change the code on all the pages I will have to have. Also, I would prefer to have everything here on 110mb.
Thanks for the help
|
|
|
|
|
Logged
|
|
|
|
|
M0ZZA
|
 |
« Reply #1 on: December 07, 2008, 04:06:12 AM » |
|
Yes, you could use PHP includes. cut all the HTML for one of the panels and paste is into a separate file. Save that as panelx. phpThen where the panel HTML used to be, insert this : <?php include("panelx.php")?>
save that file as a PHP file too now whenever you change panelx.php it will also change in the other files ALL files must be saved as .php NOT .htm
|
|
|
|
|
Logged
|
|
|
|
|
mindpetrol
|
 |
« Reply #2 on: December 08, 2008, 01:30:13 AM » |
|
Do I have to upgrade my membership to use this? Or does it work with the free account?
|
|
|
|
|
Logged
|
|
|
|
|
general vegitable
|
 |
« Reply #3 on: December 08, 2008, 01:31:59 AM » |
|
php comes free with all accounts
|
|
|
|
|
Logged
|
|
|
|
|
mindpetrol
|
 |
« Reply #4 on: December 08, 2008, 02:14:01 AM » |
|
It's not working. Do I have to have the php file saved in the same directory as the index.htm file? Should I include the [greater than sign] and the questions marks in the actual code? And when I save the php file, should I treat it like a regular html page and leave the "body" and "html" tags?
|
|
|
|
|
Logged
|
|
|
|
|
general vegitable
|
 |
« Reply #5 on: December 08, 2008, 02:16:39 AM » |
|
every file with php codes in will need a .php extention
|
|
|
|
|
Logged
|
|
|
|
|
tpog
|
 |
« Reply #6 on: December 08, 2008, 02:48:32 AM » |
|
I've been using: <?php include(str_replace($_SERVER['PHP_SELF'],"",$_SERVER['SCRIPT_FILENAME']) . "/yourdirectory/filename.php"); ?> The first part resolves to your "root" directory (e.g. /www/110mb.com/a/b/c/d/_/_/_/_/abcd/htdocs/) and you can append your directory structure / filename.type of the file to be included. This allows the file to be included from wherever the calling file is located and is portable across hosts,
|
|
|
|
|
Logged
|
|
|
|
|
general vegitable
|
 |
« Reply #7 on: December 08, 2008, 02:56:15 AM » |
|
or you could just do <?php include("directory/file.php"); ?>
|
|
|
|
|
Logged
|
|
|
|
|
mindpetrol
|
 |
« Reply #8 on: December 08, 2008, 02:56:45 AM » |
|
That's not really what I asked....but thanks for trying  . PLEASE can someone just take a quick look and tell me what I'm doing wrong, because it's still not working. Here is the page: " http://mindpetrol.110mb.com/pics/" and here is the code for that page: <head> <title>Official Mind Petrol</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style type="text/css"> .leftpanel { position: absolute; top: 0; left: 0; width: 115px; height: 100%; text-align: center} </style> </head> <body spellcheck="false"> <div class="leftpanel"><?php include(" http://mindpetrol.110mb.com/pics/leftpanel.php"); ?></div> </body> </html>
|
|
|
|
|
Logged
|
|
|
|
|
general vegitable
|
 |
« Reply #9 on: December 08, 2008, 03:03:11 AM » |
|
i think that full url include is banned, plus is that file a .php file?
|
|
|
|
|
Logged
|
|
|
|
|
tpog
|
 |
« Reply #10 on: December 08, 2008, 03:08:30 AM » |
|
<?php include("leftpanel.php"); ?> The problem is, it only works if leftpanel.php is in the same directory, it needs to be a relative or absolute path. so you could code as <?php include("/www/110mb.com/m/i/n/d/p/e/t/r/mindpetrol/htdocs/pics/leftpanel.php"); ?>
|
|
|
|
« Last Edit: December 08, 2008, 03:11:18 AM by tpog »
|
Logged
|
|
|
|
|
Zeplin
|
 |
« Reply #11 on: December 08, 2008, 03:26:33 AM » |
|
Personally Id set up some tables for example... echo "<center><table border=1><tr>"; echo "<td width=10%>Left</td>"; echo "<td width=70%>Centre</td>"; echo "<td width=10%>Right</td>"; echo "</tr></table></center>"; Set the width of each area accordingly with say, width=10% on the left and the right td's (ideally do this with css instead of html) then include or use php to choose the information I wanted into the panel. so replace Left with say, " . include 'left.php' . " To actually create an admin area to do this though starts to go well outside the scope of the forum here, but its certainly possible. You could create all kinds of widgets for the panels and include them where appropriate.
|
|
|
|
|
Logged
|
|
|
|
|
Robbi
|
 |
« Reply #12 on: December 08, 2008, 04:59:08 AM » |
|
ok so obviously the php includes aren't co-operating  whats wrong with an iframe? as long as the size doesn't need to change... and iframe would work... or if it does need to change you could use javascript to strech it... <script type="text/javascript">
//Input the IDs of the IFRAMES you wish to dynamically resize to match its content height: //Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none: var iframeids=["maincntnt"]
//Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended): var iframehide="no"
var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1] var FFextraHeight=parseFloat(getFFVersion)>=0.1? 3 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers
function resizeCaller() { var dyniframe=new Array() for (i=0; i<iframeids.length; i++){ if (document.getElementById) resizeIframe(iframeids) //reveal iframe for lower end browsers? (see var above): if ((document.all || document.getElementById) && iframehide=="no"){ var tempobj=document.all? document.all[iframeids] : document.getElementById(iframeids) tempobj.style.display="block" } } }
function resizeIframe(frameid){ var currentfr=document.getElementById(frameid) if (currentfr && !window.opera){ currentfr.style.display="block" if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight; else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax currentfr.height = currentfr.Document.body.scrollHeight; if (currentfr.addEventListener) currentfr.addEventListener("load", readjustIframe, false) else if (currentfr.attachEvent){ currentfr.detachEvent("onload", readjustIframe) // Bug fix line currentfr.attachEvent("onload", readjustIframe) } } }
function readjustIframe(loadevt) { var crossevt=(window.event)? event : loadevt var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement if (iframeroot) resizeIframe(iframeroot.id); }
function loadintoIframe(iframeid, url){ if (document.getElementById) document.getElementById(iframeid).src=url }
if (window.addEventListener) window.addEventListener("load", resizeCaller, false) else if (window.attachEvent) window.attachEvent("onload", resizeCaller) else window.onload=resizeCaller
</script>
|
|
|
|
« Last Edit: December 08, 2008, 05:01:47 AM by Grabnar »
|
Logged
|
|
|
|
|
mindpetrol
|
 |
« Reply #13 on: December 08, 2008, 05:02:46 AM » |
|
I tried using this code:<?php include("/www/110mb.com/m/i/n/d/p/e/t/r/mindpetrol/htdocs/pics/leftpanel.php"); ?>, but I still get a lot of strange stuff on my site (like the words "function.include" repeated over and over). Does anyone know why?
|
|
|
|
« Last Edit: December 08, 2008, 05:04:46 AM by mindpetrol »
|
Logged
|
|
|
|
|
codewhite
|
 |
« Reply #14 on: December 08, 2008, 05:08:49 AM » |
|
I tried using this code:<?php include("/www/110mb.com/m/i/n/d/p/e/t/r/mindpetrol/htdocs/pics/leftpanel.php"); ?>, but I still get a lot of strange stuff on my site (like the words "function.include" repeated over and over). Does anyone know why?
A link would help, but http://mindpetrol.110mb.com/pics/leftpanel.php doesn't exist so that may be a part of the problem.
|
|
|
|
|
Logged
|
 I am a signature virus, copy me to your signature to spread me <Generation 0> Increase Generation number each time I'm copied. Codewhite Designs Cigar Journal On sale now.
|
|
|
|
iNDECiSiVE
|
 |
« Reply #15 on: December 08, 2008, 05:17:38 AM » |
|
some extra info on that: Remind that file.php and file.phP or FiLe.PhP are different on linux servers: case sensitive
|
|
|
|
|
Logged
|
|
|
|
|
tpog
|
 |
« Reply #16 on: December 08, 2008, 07:41:28 AM » |
|
Just to clarify, you've created a "/pics/index.php" and a "/pics/leftpanel.php", does it work if you include as "leftpanel.php" within index.php? For the repeated errors, have you got any recursive code (not sure if you can, but it may be including a file within itself)? If it ony fails when you use the complete "/www/110mb.com/......." string, can you confirm that's right for your site, as I was assuming this is the string to use.
|
|
|
|
|
Logged
|
|
|
|
|