0

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
?>
2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by |DarkBerzerk™|
1

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.