+ 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. ??

21st Jun 2017, 12:21 PM
ISHTIAQUE BIN IDREES
ISHTIAQUE BIN IDREES - avatar
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>
23rd Jun 2017, 9:00 AM
LaserHydra
LaserHydra - avatar
+ 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.
23rd Jun 2017, 5:46 AM
ISHTIAQUE BIN IDREES
ISHTIAQUE BIN IDREES - avatar
+ 2
@LaserHydra, Yes I'm doing this using JQuery. Can you please share real example of that php script?
23rd Jun 2017, 7:34 AM
ISHTIAQUE BIN IDREES
ISHTIAQUE BIN IDREES - avatar
+ 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.
22nd Jun 2017, 5:09 AM
LaserHydra
LaserHydra - avatar
+ 1
Nice, Thanks. I'll try. 🌷
22nd Jun 2017, 8:09 AM
ISHTIAQUE BIN IDREES
ISHTIAQUE BIN IDREES - avatar
+ 1
I suppose you are doing that over javascript? I recommend doing it in the backend per php as said.
23rd Jun 2017, 7:32 AM
LaserHydra
LaserHydra - avatar
+ 1
Thanks, I shall try this.
23rd Jun 2017, 1:11 PM
ISHTIAQUE BIN IDREES
ISHTIAQUE BIN IDREES - avatar