Creating a Website for a Shop with Multiple Locations - php

I have a quick question. We are building a site for a shop that has 12 different locations. So there is a Portal page, and then the 12 locations pages.
The design is the same for each location, just different text and rotator images. What I did before for another site was just used PHP and a Database, and had a site.php?shop=city&page=about and just did some rewrites so it would be /city/about/ which works good.
That way when I need to make an overall design change, it will apply to all locations instead of duplicating the site 12 times and if I catch one thing, I need to do it on all 12 sites.
One thing that we don't like about that is if someone in the team needs to make a change to the text, they would need to go in the MySQL Database to make the content changes which they are unfamiliar with. I could create a basic CMS but I would like some suggestions on what else I can do to make this easy on everyone.
If I need to create one of the sites and duplicate it 11 times, I could do that but was just seeing if there were any easier ways you guys know of, where it would still be easy for people to update the content with FTP.
Thanks!

From my point of view you have a few options:
Build a basic update form with a basic WYSIWYG editor, more or less a very basic CMS
Use an include file structure then the user only needs to edit a text file for example for changes to reflect on the site, note they may need to know basic HTML and FTP is likely to be required
Give access to phpMyAdmin, again note they may need to know a little HTML (edit: as already suggested I just noticed, sorry need to load answers while I'm typing)
Install an out of the box CMS in the 'locations' or 'stores' directory and only have it used on these pages
Personally I would just build a simple CMS in this case... then again I have built around 15 CMS' in the past so it only takes me about an hour to code something like this.
Hope that helps you.

It is not ftp, but if you gave them access to phpmyadmin, with a login that only has access to that table then they could edit the data.

Related

Looking for a way to change all headers and footers on my html/css website at once

I built my website in 2007 using html and css which I learnt from a book. I'm a jeweller and it's used as a portfolio of my work and therefore has lots of photos on it and separate pages with each photo. I have continued to add photos and pages and not made much changes to the overall structure of the website, just copied and pasted the code into each new page and changed the bits I needed to.
But now I want to change the headers and footers of all these pages, and there's hundreds of pages!
After some reading it seems I can use PHP (just finding out about this) to insert headers and footers. Which seems to mean I'd need to edit every page of code anyway, and change all links in the code to .php, which would be the same (or more!) amount of work as just changing the code on every page to be what I want, although will make it easier next time I want to change.... so wondered if there was another way of doing this?
First time asking anything on a web developer forum! As I'm sure you can tell I'm no expert so keep things simple please! My website is www.islayspalding.co.uk. Many thanks :)

Existing Website Management & Content Modification without CMS

My client needs function for editing and updating the website content (text, image etc) with ease. Not with FTP or other thing but rather just page from where he can edit easily..
I found some website which provide this service a year back. The procedure was simple
1) Click the Admin button and enter credentials
2) Now in place editing feature is enabled.
I know there are javascript for inplace editing but i do not need that..
I want a MODERATOR page from where i will (admin) set which content he is allowed to modify.
I tried using
PHPMYEDIT
and was happy but the program is too old fashioned there are many thing which are not updated..
Just like the PHPMYEDIT i need a Program OR a service online which have a feature of
Existing website content editing / update / delete / modify
My website is in PHP / MYSQL / JAVASCRIPT / JQUERY and other addons.
Kindly suggest a solution to my problem.
recently i came up with a site
http://grabaperch.com/
that does exactly what i say but it is little complex (for the client) still suggest any thing like that. Suggestion are welcome..
Important - The pages/content are static
I've used a service called CushyCMS before, with varying degrees of success. It does require that you add a class to the HTML selectors that you wish the client to be able to edit.
It is a type of 'lite' CMS without really being a CMS (it just hides the FTP transactions in the background and gives a simple WYSIWYG interface.
Hope that helps
If you can convert the website into wordpress it will be the best solution
If grabaperch.com is little complex for you,
take a look on Uzuvi, https://getuzuvi.com
This very little CMS also, like Perch, can be a drop-in editor of existing website.
But Uzuvi console UI has ultra simple design.
Need to say this CMS has no moderator feature you mentioned, may be yet.

Argument for PHP vs. DWT

I was having a "discussion" with my manager today about the merits of using PHP includes and functions as a template to build websites more quickly and efficiently. He has been using Dreamweaver templates for years and sees it as really the best way to go. I would like to start using some different and more efficient methods for web creation, because we need to get through our projects faster. I would like to know in detail what would make Dreamweaver dwts better than using code to accomplish the same task, or vice versa.
His reasoning is:
When you change links on the dwt file, it changes links for every page made from that dwt.
Even if you move pages around in directories, it maintains links to images
Everyone in the company should do it one way, and this is the way he chose (there are two of us, with someone who's just started who needs to learn web design from the beginning, and he plans to teacher her the dwt method)
If you edit a site made with a dwt, you can't change anything in the template (it's grayed out), making it safer
If he's building sites with dwt, and I'm doing it with PHP includes, we can't edit each others' sites. It gets all over the place. When we have new employees in the future, it will get all crazy and people can't make changes to others' sites if they're out of the office.
I've been studying PHP these days, and am thrilled with how powerful it is for creating dynamic pages. The site in question which sparked this "discussion" is more or less static, so a dwt would work fine. However, I wanted to stretch my wings a bit, and the code was getting REALLY jumbled as the pages grew. So I chopped off the header, footer, and sidebar, and brought them in to all the pages with a php include, as well as dynamically assigned the title, meta data, and description for each page using variables echoed in the header.The reasons I like this better are:
It's cleaner. If every page contains all the data for the header and footer, as well as the extra tags Dreamweaver throws in there, then I have to sift through everything to find where I need to be.
It's safer. It's sort of like the above reason dwts are safe, except I do all my code editing in a text editor like Coda. So on occasion I have accidentally deleted a dwt-protected line of code because those rules only apply within dreamweaver. I can't chop off part of the header if I can't see it. Incidentally, this makes it easier to identify bugs.
It's modern. I look through source when I see great pages made by designers and design firms I admire. I've never seen dwt tags. I believe by using PHP to dynamically grab files and perform other tasks that keeps me from having to go through and change something on every page, life becomes easier, and keeps things streamlined and up-to-date with current web trends and standards.
It's simple. This should be at the top of the list. Like I said we have to train a new person in how to create for the web. Isn't it much better for her to learn a simple line of PHP and get an understanding for how the language works, rather than learn an entire piece of (not exactly user-friendly) software just for the purpose of keeping her work the exact same as everyone else's? On that note, I believe PHP is a powerful tool in a web designer's arsenal, and it would be a sin to prevent her from learning it for the sake of uniformity.
It's fast. Am I mistaken in my thought that a page build with header and footer includes loads faster than one big page with everything in it? Or does that just apply when the body is loaded dynamically with AJAX?
I did extensive searching on Google and Stack Overflow on this topic and this is the most relevant article I could find:
Why would one use Dreamweaver Templates over PHP or Javascript for templating?
The answer is helpful, but I would really like to understand in more detail why exactly we shouldn't switch to a new method if it's simpler and has more potential. My manager insists that "the result is the same, so if there isn't something that makes me say, 'oh wow that's amazing and much better!', then we should just stay how we are now."
(I do apologize for the length of this question, but the guidelines asked that I be as specific as possible.)
Like I said in comments, without knowing what exactly sites you are working with it's hard to tell which PHP features are most important to showcase. However, I can try and describe the most simple kind of sites I was dealing with, and where and how PHP came in handy. If you work with something more complicated, the need of programming language may only increase.
The simple website may have a few different pages with text and images. I'm assuming nothing interactive (i.e. no inquiry form), no large amount of structured data (i.e. no product catalog), only one design template which is used by every page with no differences whatsoever. Here's the typical structure:
One PHP file (index.php) for handling all sorts of php-ish stuff
One design file (template.php for example) for storing everything html-ish (including header, footer and more. Basically all html with placeholders for text and menu)
One CSS file for, well, the site CSS
Most of the texts are stored in database or (worst case) just txt files. Menu (navigation) is stored in database as well
Images folder with all the needed images
The key features here are:
Simplicity. You only have as many files and code as you really need to keep things organized and clear
Reusability. You can basically copy/paste your php code with little to no changes for a new similar website
No duplicates whatsoever.
Data and design separation. Wanna change texts, fix typos? You do it without as much as touching design (html) files. Wanna make a completely brand new design for your website? You can do it without even knowing what those texts are or where they are kept.
like deceze said, no lock-ins. Use whatever software you like. (Including Dreamweaver)
PHP is responsible for taking texts, menus, design and rendering them all into a web page. If website is in more than 1 language, PHP code choose the right texts for the language of visitors choice.
If texts are stored in database, you don't even need notepad and ftp. You just need, i.e., phpMyAdmin (stored in server) so you can connect directly to database and edit any text you like using only web browser; from anywhere in the world. (I am assuming no real CMS). If you need to add one more page, you connect to database using myAdmin and browser, enter the page name (for menu) in 1 or more languages, enter the text for new page (in 1 or more languages), done! new page created, name placed in the menu, all hyperlinks generated for you. If you need to remove a page, you connect to database and click delete. If you need to hide a page for a while (i.e. for proof reading before publishing), you connect to database and uncheck "published" box.
All this doesn't come with just using database ofcourse, you need to program these features with PHP. It may take about 1 - 3 hours depending on experience and the code is fully reusable for every similar website in the future. Basically you just copy/paste php file, copy/paste database tables, enter new text and menu into database, put placeholders into your html file and done! brand new site created.
Which immediately makes most of the reasoning for DWT irrelevant. You don't move files around because you have only one html file and no directories, you don't need grayed out template because texts/images (content) and template are not even in the same file, there's no such thing as changing links in dwt file because it's PHP that generates them on the fly (these are not real links to real html files but rather links with parameters to tell PHP which exactly page must be rendered.. because remember we have just 1 file). The bottom line is, comparing features of the two side by side is like comparing features of a sword vs machinegun. Sharpness and length of the blade concepts are meaningless in a case of machinegun; while lifetime sword user won't really get the meaning of velocity and caliber before he tries and uses machinegun. And yet, while you can't compare their features one by one, no one brings sword to a gunfight for a reason :)
As for #3, currently there are many more people working with PHP than DWT (in a case you will need more employees in the future, or if other people will need to work with your websites later, etc.) As for #5, you can edit PHP websites with Dreamweaver as fine as DWT websites.
That's just off the top of my head. I wrote this in my lunch break so I likely forgot or missed quite a few things. I hope you will get a proper answer with detailed DWT vs PHP comparison too.
You simply can't compare PHP vs. DWT.
PHP is a programming language, where templating is just one of it's numerous features, and DWT is just a silly proprietary system to build simple web pages.
there is actually nothing to compare.
I would say that using DWT templates over PHP do have some advantages.
It does not need any extra server-side process, like PHP to process the files at the server.
You can serve all files to the user as .html files rather than .php files, though I suspect that it is possible to hide the .php extension. Why should any user see anything other than .html?
You don't have to learn PHP syntax/programming. It is true that you can do more with PHP that plain .dwt files but for plain templating the .dwt files can be just as clean.
It is not true that .dwt files are a lock-in technology. The feature is also implemented by other web editors, e.g. Microsoft Expression Web.

Building PHP WYSIWYG Editor

I am building a web application in which the user may add a page, edit the layout, drag drop element, resize element, format the text, edit the element attribute etc.
In the page the user may include (retrieve) dynamic data, like maybe data from database, data generated by php code, etc.
I have played around with cakephp and jquery lately and tried to build this app. But I stumbled upon on how to appropriately display the php code. I tried to look into the cakephp core code and find about output buffering and tried to utilize output buffering to parse the php code and use regex to display it but it is more likely to reinvent the wheel if I write the parser my self
What I am asking is:
Ok, to be more simple and specific I just want to ask, how to save and load the page that was created by the user especially if the page contains php code. I just want to know is there any other method than write my own parser or maybe a library to parse a php code?
Ok that's all for now, does anyone have any idea how to implement it? Or maybe any page / website that could be useful to take some reference from? Maybe a sample code from which I can take some reference
Thanks
I'm not sure you'll find any good answer here about that.
Whoa I don't know where to start. I'll start by the number 3. You want widgets. Then that means you have to create widget class or objects that possesses a template or something that makes them drawable "well, kinda". If I were you it would be loaded from javascript and not really from php. Each widget would be in some way individual applications loaded in a div using javascript.
Point 2, You wanted widgets. When you add widgets to your page, you have to save some informations, like Position, Title, dimensions and so on. You may even save creation parameters. For exemple a ListWidget may be started with different ItemProvider. That way you don't have to write 1000 widgets but only one that shows different content. That said you have widgets, dimension and position. Now that lead us to point 1.
Point 1. Once you have your widgets, position and dimensions, you send the data you used to create them associated with the page to the server. That lead us two point 2 again.
Once you have saved a page. You can see it by retrieving all widgets with parameters and so on. That leaves you 2 options.
Generate Javascript that will recreate the saved widgets.
Generate Html will all the widgets.
Option 1 is simpler since option 2 won't bind html to javascript by itself. Solution 2 on the other hand is better since there is only 1 request to the server.
Oh and a last thing, You should set yourself some limits. That kind of thing can get very complicated and unfortunately not that great. See drupal for example. It does lots of cool stuff but as soon as you install lots of module. Drupal transform itself in some sort of memory eating monster. And almost all the time you don't really need that much of dynamic content. Fixed layouts will do work nice almost 99% of the time.
I'm also forced to say that but if you try to create an application that give users as much power as a scientist that could raise a 7 legged cat. I think you're going to play with really obscure forces!

How do I create a CMS for a news portal? [closed]

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
OK I'll try again, sorry if it's too simple for you; we all have to start somewhere.
I need to use a webpage to specify the layout of the newspaper ie header, footer and news areas. This is produced by an HTML page which I have created [the one with check boxes and a create button].
A second web page is to add content to the various components; again, I have the HTML page with 3 sections for input to the header, body, and footer, each with a save button. The content then needs to be output.
The information is to be stored in a MySQL database, but I only need to use the web forms I have already created in HTML to design the layout and add content. The database is to store the layout and content information.
Changes to the database tables should dynamically reflect changes in the presentation page.
The database I have already created has 6 linked tables so far [layout, header, footer, local,national and international]. I also know the MySQL code to link with the database, but not how to code to POST information to the database from the web pages via php handling to the database or GET information from the database.
Can anyone help?
What I've learnt so far:
If you create a CMS you'll gain tons of programming experience.
If you want to build a news portal for a real client avoid [1] and use an existing CMS.
Although there are a number of frameworks and cms's systems that you could use. The php commands you are looking for to interact with the database you will find here.
http://ca2.php.net/manual/en/function.mysql-query.php
I hope this helps.
It sounds like you are reinventing the while, and all the problems that will come long with it. May I suggest you use an existing CMS? There are a myriad of options, but some of the more famous that come to mind include...
Plone
Joomla
Drupal
TYPO3
WordPress
There is even a wikipedia page on the subject: Web content management systems
I am actually working on a similar project. Dont use an existing CMS... most cms are overkill for something this basic... It also gives you more control over everything and it is a great way for a beginner to learn PHP and how to work with databases... One tool I have found helpful is FCKeditor... It allows the client to create a detailed layout just as if they were using Word but will return HTML to you...
Look into:
drupal
wordpress
As starting points. Good luck.
I have had success using WordPress in this fashion and would recommend it.
This post was helpful to me doing something similar:
http://blueprintds.com/2008/03/13/top-10-wordpress-cms-plugins/
As far as composing a page with separate content sections there are several approaches to take. Here are 2 common ones.
Approach 1: Make your theme's page or index template pull the content from separate "pages" or "posts". Choosing the section to include based on either categories you set on the "page" or "post" meant to display in that section or a customfield value indicating they are to be displayed in a section. I like this approach cause you get the nice html wysiwyg editor and versioning for the content.
Example of template:
html
<? php /*call main pagecontent*/ ?>
html
<?php /*call 2nd section of pagecontent (posts where category = '2nd section' limit 1)*/ ?>
more html
<?php /*call 3rd section of pagecontent (posts where category = '3rd section' limit 1)*/ ?>
etc
Approach 2: Use custom fields for the separate content sections for a single post (number of disadvantages here but it might be more straightforward to get something quickly.)
If more detail is desired for the above let me know.
I'm doing something similar for a client. Because of deadlines and budgets I gave up and have to use an existing CMS. That is my advice for you on this project. But I'm sure you will continue to develop this CMS either on the side or for the project anyway so what you'll need to do is in addition to connecting to the database you'll just create a function to call data from the correct table. You use SQL syntax within a PHP function and you'll say pull content FROM tablename WHERE table column=correct row for the page. The guy who linked to the PHP manual sent you to the right page.
I must say developing your own CMS is not a bad idea like a lot of people keep saying for a number of reasons.
1. You learn a lot in the process
2. Many cms's have tons of overkill.
3. While they're all overkill they miss one important feature and thats content blocks. Pages may need more than one editable content area. Wordpress and the like only allow you one main section of the page to edit. Sure, they have dynamic sidebars and menus but that's not what we're looking for. We need a CMS that allows you to edit a handful of different content areas of a page. I'm creating my own CMS for just this purpose. I'm having problems separating the code in such a way that I can just call functions within different page templates bu that's another story. Anyway, use the info in that PHP manual link. I think that's exactly what you're looking for. In the meantime don't give up on that CMS and don't listen to everyone who says that the world doesn't need yet another one. It does. A barebones one that pulls more than one main content area from a DB into a page. That's all. No plugins, no overkill. Just chunks of content. Maybe share your source code when you're done so some people can learn?

Categories