/    Sign up×
Community /Pin to ProfileBookmark

Designing with an iframe.

I have an extensive nav. I considered making a single page that carries the nav and loading all other pages via an iframe. but I am not good with javaScript yet and all my searching has left me with few answers. can anyone help?

to post a comment

7 Comments(s)

Copy linkTweet thisAlerts:
@SempervivumJan 11.2022 — If you consider using javascript there is no need for an iframe: You can load the other pages directly into a container, commonly a `main` element.

However there is a server side alternative: Put your nav into an external file and include it in your pages by PHP include.
Copy linkTweet thisAlerts:
@Lenso43authorJan 11.2022 — @Sempervivum#1641394 This is a very helpful suggestion. I have used the PHP method in the past with the help of a php programmer, but I don't actually know how do do either method, and I can't find my old work to see an example.

do you have any suggestions. I would like to load the page directly into the main element. this is how I have the page set up currently, I just don't know the code to get me there.
Copy linkTweet thisAlerts:
@NogDogJan 12.2022 — Simple(?) example (however, due to a current issue in this forum, remove the hyphen from the "<-?php"" tag):

menu.php:
<i>
</i>&lt;ul&gt;
&lt;/li&gt;I'm a menu item&lt;/li&gt;
&lt;/ul&gt;

test_page.php
<i>
</i>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;test&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;-?php include($_SERVER['DOCUMENT_ROOT'].'/menu.php'); ?&gt;
&lt;h1&gt;TEST&lt;/h1&gt;
&lt;p&gt;This is a test.&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;
Copy linkTweet thisAlerts:
@Lenso43authorJan 12.2022 — @NogDog#1641396 Thank you. Each of the web pages I link to primary document need to be php files correct?
Copy linkTweet thisAlerts:
@Lenso43authorJan 12.2022 — Here we go with my lack of experience again. I will have to do this with javaScript because I am not set up to work with a server. If I understand correctly, I need to have a server in order to open PHP files in a web browser. I am working on a javaScript solution, though, I don't know how good it will be. I will post it here when I am done so I can get some schooling.

In the meantime if anyone has some helpful hints, I would love to hear them.
Copy linkTweet thisAlerts:
@NogDogJan 12.2022 — @Lenso43#1641397

Yeah, that requires PHP running on the server. There are a number of ways to get a web server with PHP running on your personal computer, but may not be worth it to you if you can come up with a decent JavaScript option. (I'm a server-side guy who mostly sucks at JavaScript stuff. ;) )
Copy linkTweet thisAlerts:
@Lenso43authorJan 12.2022 — @NogDog#1641399 Im an HTML and CSS guy who sucks at anything programming. But some day Ill get there.
×

Success!

Help @Lenso43 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.23,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...