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 trying to learn, how to make a php content management system. I'm watching tutorials and reading documents about that but I couldn't understand something. For example there is 5 different page design.
Home Design
About Us Design
Products Design
Gallery Design
Contact Design
When I click new page button what should happen backside. Should it create a new php file or just insert a new line to the database. And for example when I want to create products pages at 3 different category. Should I need 3 products.php file or just one file for products design. And when I want to add a page should I design 5 different admin interface for each page? Actually I am not asking for code. I just want to learn the best way to do these things.
Thanks all :)
You should make a table in your database, call it "pages" and add columns:
id
title
content
published_date
status
and any other.
Then pass the page id via url (?p=123) and use query to show the relevant page via database.
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 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.
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
Okay, so currently I'm creating a website from scratch for my small online shop and am stuck on where to even begin when it comes to my Products page. Currently, I have 1 page that displays all 50 of my products. I plan on expanding my products and do not want someone to be scrolling down the whole page. I would like to add multiple pages that you can click through and I believe I can accomplish this through Pagination. Now, this is the part where I get confused : say I only want 25 products to be displayed per page and I add a new item to the first page - how do items get 'bumped' to the page 2, 3 etc.? I would imagine there is some function to accomplish this, but the only way I can think of is doing this the brute force way of manually moving a product out of one page and onto another. Any suggestions??
Currently, my website is coded in all HTML / CSS and I currently just learned how to use PHP to mass edit certain areas of the website -- I am in the learning stages! Any suggestions would help. Thanks!
You need the help of a database to paginate your products in sets.
Basically, the database will have a "Products" table, each row in the table will represent a single product. You will use PHP to ask the database to retrieve the first/next N rows and then write out the appropriate HTML around each returned row to create a list of products.
There are lots of tutorials on the web to help you learn while you practice. Good luck!
There is no way to do that on static HTML web-site.
You need server-side script (e.g. PHP script) for splitting your product list by pages. By the way, you should store your data in DB and it should be done on the DB-side to not overhead your PHP side.
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 have been searching for a result on google, but I haven't succeeded yet :( .
I'm trying to change the destination of a post link within wordpress.
I have a link to a category page, this category gets (at the moment, but not limited to...) 3 posts.
What I would like is that those posts each link to another category when clicked. But i dont want the links to be hard coded, so i could change to what category they link at any time.
Is there a way to make this work? Or is there a (fairly simple) alternative way of doing this?
Your posts act like categories. So why should a link to a post redirect to a category page (this question is rethorical - semantically it just shouldn't)?
You should try to define your system via categories and subcategories. Wordpress offers huge functionalities for this system and there are plugins out there if you want to extend your categories with additional post-like content (thumbnails, formatted descriptions, etc.).
If you need user interaction you can easily build a form with ACF, NinjaForms / GravityForms where other people can add such category items.
I really don't want to be rude - but having posts that actually link to categories instead of behaving like posts sounds just wrong.
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
I am a newbie and have been programming this site for a school. And I have been stuck in a part where I have to show the logged in users the subjects he/she is currently enrolled in. I am thinking of making it appear using Ajax with a click of a menu button on the left side. So how do I populate this with a card for each subject he/she is taking? The subjects is stored in a MYSQL database. I am currently using Codeigniter Framework. Would you suggest using scripts like Angularjs? I am very new to this. Here is the sample site:
If you are very new to this, I suggest you first use regular GET/POST based interactions with the site so that clicking on a button will reload this page, or a new one with the relevant information.
Once you have moved from total newbie to a novice/rookie, you can start converting some of those areas to Ajax.
Once you become fully comfortable with that, only then should you think using JavaScript frameworks like angularjs or backbonejs.
Its an incremental skillset acquisition, and is always best done like that.
All the best!
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
I already have the info i need in the database. I know how to display the data on the main page, but i only show a small part of info there.
What i need is when i click on the read more i want it to link to a full info page.
How to i accomplish that? Do i have to make/generate a html file for every car i have and link the info from the main page to it? Or what is the correct technique for achieving this ?
It sounds like you want to have a list of cars on a main page, and then clicking on one of these cars would bring you to a details page with more information about that specific car.
This is a common situation. You'd simply have your main page query your car table and format that as a list of cars, each with a link to a details page like /details/12345 where the number represents the ID of the car you want to see. Then your details page would get the ID from the URL, query your database for details of that car ID, and assemble the page with those details.