/    Sign up×
Community /Pin to ProfileBookmark

Just a simple website but with many pages

Can you advise me if this is a good solution?
![https://i.imgur.com/uoBJgdZ.png](https://)
Of do you guys have a better solution. Thanks!

to post a comment
PHP

18 Comments(s)

Copy linkTweet thisAlerts:
@ginerjmJan 14.2022 — What are you asking us to do? Did you code the above?
Copy linkTweet thisAlerts:
@cipokauthorJan 14.2022 — @ginerjm#1641525 I'm just asking for a better solution, if there is one.
Copy linkTweet thisAlerts:
@tracknutJan 14.2022 — Yes, that's a pretty standard way of including headers and footers. If you truly want the main file suffix to remain ".html" though, you'll have to configure (in .htaccess) php to read files with that suffix - usually it would not.
Copy linkTweet thisAlerts:
@ginerjmJan 14.2022 — Then perhaps we need to hear what it is that you are trying to do?
Copy linkTweet thisAlerts:
@cipokauthorJan 14.2022 — @tracknut#1641527 I only have nginx. Yes, I would like my pages to be in HTML format..
Copy linkTweet thisAlerts:
@tracknutJan 14.2022 — You might also consider including just one php file at the top of the page, and in that php file you might have a whole bunch of useful php code including functions OutputHeader() and OutputFooter() which you call at the appropriate places. That would let you just include a single php file and get more mileage out of it that just the header and footer content.
Copy linkTweet thisAlerts:
@cipokauthorJan 14.2022 — @ginerjm#1641528 Just a simple website, as depicted in the image. But with many images, so I would need to be able to change header/footer easily in any case.
Copy linkTweet thisAlerts:
@tracknutJan 14.2022 — @cipok#1641529 I don't know nginx and whether it has a capability similar to .htaccess, sorry
Copy linkTweet thisAlerts:
@cipokauthorJan 14.2022 — @tracknut#1641530 That does sound great! So that just one php file would be like a functions.php (from WP) with all I need to call inside my pages, right?
Copy linkTweet thisAlerts:
@cipokauthorJan 14.2022 — @cipok#1641531 "But with many images" = But with many PAGES , sorry
Copy linkTweet thisAlerts:
@ginerjmJan 14.2022 — I would think that the header and footer would mostly be the same from page to page and the middle part would be the part that is different for every page. Why would you then need php for those?

And if you want to have your site "in HTML format" then each page is going to be a lot of work. Sure you can easily modify the header and footer with a few lines of php coding but the meat of the page is the real work, no?

And - all web pages are in html format. It's how they get built that is different from site to site.

What is this 'buy' that you refer to?
Copy linkTweet thisAlerts:
@cipokauthorJan 14.2022 — @ginerjm#1641535 Yes, I might need to make changes regularly to the menu so I wouldn't want to edit all the pages, I would just make changes to head.php for example

"What is this 'buy' that you refer to?" - I don't think I understand this question.
Copy linkTweet thisAlerts:
@NogDogJan 14.2022 — Might want to use include instead of require, depending on whether you want the page request to fail with a fatal error if for some reason the file cannot be found/read (require will fail, include will just log a warning). The _once part for either of them is probably not really serving any purpose in this case, as you probably are not trying to define any PHP classes/functions in the included file?

My personal preferred method over the years has been to create a file that has a function for each "boiler plate" part of the page. Then I require_once that file, and call the relevant function where needed.
[code=php]
<-?php // had to add "-" to php tag for the forum to allow it
require_once $_SERVER['DOCUMENT_ROOT'] . "/path/to/page_functions.php";
echo page_head('Title', 'list, of, keywords');
echo page_menu();
echo page_sidebar();
?>
<h1>My Page</h1>
<p>Lots of amazing content here</p>
<-?php // had to add "-" to php tag for the forum to allow it
echo page_foot();
[/code]
Copy linkTweet thisAlerts:
@ginerjmJan 14.2022 — Your topic's title says "Just a simple website buy".
Copy linkTweet thisAlerts:
@cipokauthorJan 14.2022 — @ginerjm#1641538 Sorry for that, I meant BUT not buy.
Copy linkTweet thisAlerts:
@SempervivumJan 14.2022 — ["Just a simple website buy with many pages","Just a simple website but with many pages"]
Copy linkTweet thisAlerts:
@SempervivumJan 14.2022 — @cipok#1641539 I changed this in the title in order to prevent confusion.
Copy linkTweet thisAlerts:
@tracknutJan 14.2022 — @cipok#1641533 yes exactly. Same as NogDog is describing below
×

Success!

Help @cipok 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 3.29,
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: @darkwebsites540,
tipped: article
amount: 10 SATS,

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

tipper: Anonymous,
tipped: article
amount: 10 SATS,
)...