Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
i'm a beginner in php but want to expand my knowledge. so i want to create a cms from scratch.
i already have an idea how to create a post. by inserting data to database
and populate the html file with the data(post) that came from the database
example this is my website
domainname.com/index.php --- and this is the address of my homepage
on my homepage, i want to show some preview of my each post.
something like this,
and if the user of the website click the post.
it will go to another page
domainname.com/postname.php
and with the data like this
so my question is how do the CMS create the file for every post.
the idea in my mind is creating the html file dynamically using php and naming the file with the name of the post. but is it a good practice? or am i doing it right?
While generating static files (whenever the admin interface is used to make a change) will work, it isn't a typical approach for a CMS.
Usually they will apply the front controller pattern (in which each request for a content page, despite having different URLs, is funneled through the same PHP program, something that is often achived with the Apache mod_rewrite module) and generate the requested page on demand.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I need some help with wordpress, I'm not too experienced with it, and I need to add multiple pdf to the post/page edit screen back-end and display then the added files on the front-end to let the user download them. I've found this article but I'm not sure if this is the way to follow, I will not know the labels and I'm not sure if inside a custom metabox is possible to create dynamic fields (add more fields like label and file if needed). I don't want to use a bloated plugin, how I can proceed?
The easiest way to do this is upload the PDF using the media uploader and then linking them in the frontend while creating a post.
A simple sample at - https://www.wpmadesimple.org/supplementary-guides/adding-pdf-documents/
Let me know if you need more help. This is without a plugin, though there might be more solutions like CPT/Plugins but that is based on your needs.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have made the structure of a website. I have made three .html files named index.html, blog.html, posts.html. index.html is the home page and on that page their is a link for blog.html on the blog.html page thier are some posts heading and i have connected one post to posts.html. But now i'm in trouble that if i have to made one .html file for each post then it would be very difficult so what should i do so that i have to make only one posts.html and anyhow connect it to a php file or something else so that i don't have to make many .html file for every post.
Can i use php for it, is their any command that--> if you click on this post then this page will open and if you click on another post then another page will open. By this i will give the command for all the posts and it will help me alot.
Thank you
Try file_get_contents php, or create a small ajax client to load html.
$your_html_file = file_get_contents('./test.html', FILE_USE_INCLUDE_PATH);
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am trying to create an application that will have some similar looking pages. I am not sure what is the best way to do this.
Each page will have a header, side bar, content and footer.
The tricky part here is the sections will be similar but not the same. For example the header can have a combobox and different pages will have different data. One page will have a textbox.
The data will come from SQL server via PHP.
What would be the best way to handle this?
If you are using PHP then take a look into http://www.h2o-template.org/ - the templates will allow you to create similar structures and keeping them maintanable most importantly.
You can then have base template which encapsulates all of the similarities and extend sub templates from that which make each page unique.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Im working on a PHP based web app which allows users to login. What would be the appropriate method of 404'ing all the back-end - (the actual application pages).
I've got a user-tools class which has a check-login function in it, that I use at the moment. If the user isn't logged-in, it redirects to a 404.
However I'm wondering is there a better way to set this up? Could I have a global page that has a list of all the pages that should 404 if the user isn't logged in? If so, how would you set that up?
Many website have all their traffic through a single entry point. In such a setup, you can define a constant in that single file, and check it in every file that is included, so you know whether the file was in fact loaded by the entry file. This method is implemented in MediaWiki for example.
Another solution is to put all the include files outside of the document root. Many frameworks (like CodeIgnitor and others) allow you to specify this directory, and allow you to put it anywhere you want. If it's outside the doc root, visitors cannot load files from that directory directly.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I am trying to create a site with a tiny CMS, the problem is that there is only php installed on the server.
The site will mainly consit of two pages the user page and admin page. On the user page there is to be a bunch of checkboxes which when checked will do some math(not the problem I need solved). On the admin page you need to be able to add the checkboxes and assing them their values.
My approach was to read and write to a XML file that contains the data instead of a database. I have run into a lot of problems trying to accomplish this, and I am looking for some good ideas for how it can be done, or alternatives.
Thanks in advance.
You can use sqlite as database engine. This way you also create a portable version of your application and by using PDO you could always switch to another database engine later on.