ecommerce templates - php

I am currently working with a eCommerce site for a client but to keep things organized I am wanting to group some pages in sub folders. However, because of the nature of eCommerce it relies on several pages in its base folder (search.php, products.php, etc) to generate some of the pages of content and therefore I cannot really have any subfolders unless I make copies of all the necessary pages into each seperate subdirectory and then it makes everything more complicated not to mention creates issues of its own.
I hope my question is clear enough and I was wondering what options are in a situation such as this?
Is there a way I can setup a redirect page for each of these common pages inside the sub directory to redirect to the base files but maintain any POST data?

you can try store the filtered post values to session(preferred),cache,Database, or just include a php script into to the script in which you post the form data.

Related

How do I structure folders for users logged in and logged out?

I want the user's profile to show everything (logged in navbar, textbox they use to post their content on and all of their content) and then show their profile with a logged out navbar, selected content the user wants to show and no textbox to post content.
I am breaking up the html files (e.g. header, footer and main content) into separate php files. Is that a good idea if I want to implement the above said ?
I'm still developing on localhost but here's the current file structure which is a bit messy. I'm also trying to implement MVC but due to my lack of knowledge so far, it hasn't been done.
However you seem fit, but nice practice could be dividing up backend / frontend. Or have a public and a private directory as top layer, then go from there.
And yes, breaking up your files in header.php, *content.php and footer.php is smart for what you want. By doing this, you allow yourself to edit the main parts of you page independently, without having to update many html or php files. Just one file will do for every page.
Also google stuff like "common practice" for php structures.
Account for REST in your workflow How to create a RESTfull api
This Stackoverflow on html/php inlining is also usefull maybe.

Generating sites from a single app all accesible with different domains

I need to create an application through which I can generate different sites. All these sites will have the same layout but each one will have different contents (texts, images, colors, etc).
The hard part is that these sites should be able to be accessed through different urls.
Let me give an example:
I log into the application from there I create a new site with the name FooBar and it may be accessed through the http://foobar.com url.
The same if I want a site http://foobaz.com. All sites may be generated and managed from the same administrator.
I have read about Wordpress multisite and I think maybe it could help me. If its not possible via Wordpress I can make it with some web framework like Laravel.
The main problem I cant figure out is how to map the domains with each site generated.
I think the right way to do this is to point all the domains to the same laravel app+routes so then in the controllers you can do the check of the domain the user is currently visiting and get the images and texts accordingly the domain from the DB.
In other words, make the logics on the controllers/helper level.

Duplicate content on homepage of custom made PHP script

I coded a simple php blog. On the homepage it displays the most viewed post and also links to the actual page of the post similar to the frontpage of a wordpress blog for example.
How to avoid duplicate content for SEO purposes? Is there a certain html tag or code for search engines to prevent considering the post on homepage and the actual page duplicate??
Thanks
Homepage is the page that index.php or index.html outputs, even if this is a redirection to an inner file. If you want to make a cms for example with an admin panel and offer different templates, styles and plugins, and decide to divert the design code from the engine code, it is is functionally common sense that you 'll include the template in other template-folders (to keep the filesystem clean, well-organised, and easily accessible from the design work). In this way, admin panel will insert and update your site parameters to the database and the root index file will read those parameters from the db. So the best you have to do for SEO means is to create and keep well-informed all the xml files (sitemap, feed, rss, atom), include keywords (taxonomy),tags and metadata, coherence at internal and external links, keep a clean design output and a lot more parameters that needs a lot of space and time to analyze.

Creating sitemaps with Codeigniter

I would like to know from others' experience the best way to create sitemaps with Codeigniter. I have looked at some plugins/libraries, but all check the database for the pages. What happens if some pages on the site are static and not dynamic?
Is there any way to crawl the site using PHP and creating an XML file with the results?
A tool I have used previously for my projects is http://enarion.net/tools/phpsitemapng/download/
Which is a free tool for creating sitemap and allows functionality such as cron jobs.
What is my next step? How can I achieve this?
Well, you're problem lies in the fact that you have both dynamic and static pages. So, a crawler would work, but you'd have to generate a list of links to all dynamic pages. Then, you're crawler could hit that list and have access to all dynamic pages, and then hit directories where you have your static pages.
However, the docs on the phpsitemapng that you mention state that they will crawl a live website. So, if you have links to all of your pages accessible from those pages, then that will do what you need.
Scans files on website (slower, but will also find dynamic generated files and links)

Dynamic links should be included in sitemap?

I have a website live cricket scores , in which dynamically i am controlling the news section.
I have my own custom build CMS system with PHP, where admin will add the news to the web portal.
If i generate the Sitemap, all dynamically created pages wont be added to the sitemap,
is this a good practice or do we need to add the dynamically created links in sitemap?
if yes, can you please share how we can add dynamic links?
One more observation, I have made, whatever the news which is added getting cached within 4 Hrs in google.
Please share your thoughts, thanks in advance
If the pages are important, then you should add them to the site map so they can be indexed for future reference. However, if the pages are going to disappear after the match, then I wouldn't put them on the site map as they may get indexed then disappear, which may have a negative impact on your search engine rankings.
You can add these dynamic pages to a site map in a couple of ways:
Whenever a new dynamic page is created, re-create your site map. Do this by looking through the database for the pages which will be valid and writing them out into an XML site map file.
When a new page is created, read the current XML site map, and insert a new entry into the relevant place.
I would say the easiest option is option 1 as you can quickly and easily build a site map without having to read what you already have. That option also means that when you remove a one of the dynamic pages, it will be removed from the site map when it is re-built without the need to read through what you have, find the entry and remove it.
Google code has a number of different options for you, some of which you can download and run, others look like they need implementing within your own code.
Yes, if these pages content needs to be referenced by search engines, of course they have to be in sitemap.
I worked on a lot of ebusiness website and of course, almost 99% of pages where dynamically generated, almost 1000 product pages versus the 3 sales conditions & legal static pages.
So the sitemap itself was dynamic and regenerated every 15 minutes (to avoid dumping the whole product base each and running thousands of queries each tim the sitemap is called).
You can use a sort of separate script to do this : I would do one static part template if you have static page, and one other embedding the dynamically generated urls.
It would be easier if you CMS already embed url management (or routing) system.

Categories