Dear Friends,
I am not expert in php, but i am trying to make website easy to edit with its own cPanel
i tryed this basic code to get the id of the page from the link and show the contents of the file..
and its working good..but how i make it in array...
i mean there be array and into it the id of the page and the contents..
and call the part from the array that i want to display..
and after that how to edit it easy..i mean how to open the file and change the contents of the array easy (if the user know nothing about coding)..
so all the questions is:
•how to save the contents in array.
•how to call them easy.
•how to add page and delete page and edit the contents of the pages.

<?php
$filenamehome="home_contents.php"; // The File That Contain The Contents Of Home
$handlehome=fopen($filenamehome,"r");
$contentshome=fread
($handlehome,filesize($filenamehome)); // Now The Contents Of Home Page Saved In $contentshome

$pages['home'] = $contentshome; // Define the 'home' as the id of the page
$pageid = $_GET["pageid"] ; // Get the id from the link
echo $pages[$pageid]; // echo the page contents so if the link is index.php?pageid=home will echo the contents of home
?>

Recommended Answers

All 2 Replies

Read about the PHP explode command. In order to use it for what you want, your file will need to have a unique delimeter between the fields that you wish to break into separate array elements.

What you are trying to do is what a Content Management System (CMS) does (but in a less effective way). A CMS normally uses an editor like FCKeditor to allow the user to edit the page contents. The content is then stored in a database (usually MySQL). I suggest that you consider using a CMS rather than trying to create your own version.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.