+ 2
Expert Opinion Required with Strong Logic
Instead I rewrite code for each webpage, I want to stay on the same page which has my site info, nav, footer and header etc. What are the potentials, drawbacks or advantages if I load other pages (having no header, footer or nav) into an iframe element. ??
7 odpowiedzi
+ 3
Example with ?page=pagename parameter
<body>
<?php
$directory = "/pages/";
$page = isset($_GET['page']) ? $_GET['page'] : 'home';
$path = $directory . $page . '.php;
if(file_exists($path))
include $path;
?>
</body>
+ 2
👀 http://nhec.uphero.com
check this out pls. I'm using one header on page,
and have one div element, clicking an anchor ⚓ tag on navigation will retrieve the html file into the div.
I don't think it is recommended? Your comments and advices are strongly encouraged.
+ 2
@LaserHydra, Yes I'm doing this using JQuery.
Can you please share real example of that php script?
+ 1
I'd recommend you loading your content with PHP instead of an iframe.
Therefor you can have one base template and using "include" you can load in the content.
+ 1
Nice, Thanks. I'll try. 🌷
+ 1
I suppose you are doing that over javascript?
I recommend doing it in the backend per php as said.
+ 1
Thanks, I shall try this.