Building a CMS admin panel - drupal

I would like to build a CMS/backend in PHP for my websites to manage different things like photos, albums, news and in general creating dynamic content.
For example I would like to make a website where the owner can create a list of all his products with different attributes (text, images etc).
I know I could make my own CMS with an admin panel and I will have all the problems like users manage, CRUD functions for objects etc.
What I'm looking for is something between a CMS (like drupal or Wordpress) and Yii or Zend Framework.
I don't want to use this (CMS) to build frontend pages in total, like how drupal and wordpress do, because when i will create the frontend i just want to include my cms and use his functions like include_once(cms.php) and then use objects created by this CMS like echo $object->title etc.
What is the best and fastest way to create this?
I like how drupal creates content types where you can choose how to build this content like insert an image field or a text field etc but I think I can't just include Drupal in my frontend and use echo $object->title and also I like how Yii creates modules with CRUD functions.
What do you suggest?
Should I start from Yii or Zend and then use this as an admin panel or should I start from drupal and then try to include and use its functions in "external" pages?

IMHO Fastest way is to get a working system and try to manipulate to make act like you want, add code to your needs. this way you don't have to worry about some common tasks but there is a little learning of how that system works part.
but if you have time, you can always start from the ground up and make your own, just add what you need is making a faster system, but there is a difference between a system that has small team of developers (or you alone), and a system that has large number of users and a community of developers behind it.
for starters I would suggest to work on a reliable system, and build on top of that.

Related

Custom code in Wordpress: what are the programming limitations?

I have a website (www.easterisland.travel) that I'm considering converting into a Wordpress site. Why? Basically for the following reasons:
1: To use a CMS, so that I can teach others to further add content to the website without having programming knowledge. I would built the advanced pages myself though, and the pages that others would manage would be simple information pages.
2: Access to all of these great plugins, for example the "similar pages" plugin at the bottom of each page (which I haven't found as a independent solution for raw webpages), which is just fantastic to keep people reading.
At my site I have lots of custom stuff like booking systems that I've created. There's an AngularJS shopping cart (www.easterisland.travel/tours/), instant online booking and payment (using PayPal's Express Checkout) etc. There's a page for cruise ship shore excursions (www.easterisland.travel/cruise-ship/) that's automatically generated from database data, and I've created a system where I can add cruise ships and shore excursions (adding correct itinerary, price, info etc). Passengers can also log in and communicate to other future fellow travelers within the same group, and get organized for meeting up on the tour day. I have many more plans to go as well, for example showing hotel info, displaying TripAdvisor data (using TripAdvisor API) etc.
The million dollar questions are:
1) Can all of this be achieved in a Wordpress site? Can I add all of these systems using this platform? What are the limitations?
2) Would it make sense to change to Wordpress?
3) What implementation should be used? I don't want my code to be removed or altered when Wordpress is automatically updated.
Thank you!
Wordpress doesn't have any limitations, you can extend its default functionality if it can't accomplish what you need with either plugins or custom code. and having a framework is always better than building from scratch in many ways.
HOWEVER, wordpress was originally design as blogging platform, and if you plan on extending its simple functionality you should take some time to understand how it works to properly integrate your custom needs or things could get ugly,
If you know how to interact with the database, you can easily do what you want, there are built-in functions you can use according to your needs for database interactions or just create your own if it doesn't fit well very much.
just a quick overview with wordpress database.
wp_posts - where sites main front-end data are stored, like posts, pages,
wp_postmeta - storage for additional data that are stored on wp_posts
wp_comments - storage for user interaction data for wp_posts like comments, I've also used these before to store user/admin messages.
wp_terms - use for dividing/categorizing wp_posts data, like categories and tags,
wp_options - use for back-end storage data and configuration.
You'd need to check out these functions as you're probably will encounter them in the future
https://codex.wordpress.org/Function_Reference/add_post_meta
https://developer.wordpress.org/reference/functions/get_post_meta/
https://codex.wordpress.org/Function_Reference/update_post_meta
https://codex.wordpress.org/Function_Reference/register_post_type
https://codex.wordpress.org/Function_Reference/register_taxonomy
https://codex.wordpress.org/Class_Reference/WP_Query
If you also need database interaction, check out https://codex.wordpress.org/Class_Reference/wpdb
and for front-end implementation, check this out https://developer.wordpress.org/themes/basics/template-hierarchy/, though I never used any other wordpress theme except Genesis Framework for these past 5 years as I never had to mess too much with HTML codes and almost everything can be customize using actions & filters. I advise you to use Theme Framework (and remember to always use CHILD THEME to be safe from Main Theme upgrade)
You might also want to check -> https://github.com/WebDevStudios/CMB2 (I prefer to use this than Advance Custom Fields plugins.)
Booking system in wordpress is a bit complex, I've successfully use gravity form as booking system with AngularJS + Ajax, but never tried a custom one from scratch and don't have a chance to use booking plugin as never encountered a cleint that wants a simple booking system.
Just to answer your question.
Yes, It can, for comparison, take a look at woocommerce plugin functionality and features, I believe thats more complex than what you need.
It would make sense to convert a site built from scratch to any CMS (wordpress is an option), the CMS is up to you, though its better to use the one that you know more for easier integration and customization.
You can use your child theme "functions.php" for extending your custom functionality, like create a folder in your theme for all your custom code and include/require it on your child theme functions.php or better create your own plugin to properly integrate them, you can divide the functionality in plugins, like plugin for booking system and plugin for payment functionality. check this out https://github.com/hlashbrooke/WordPress-Plugin-Template
I hope this would give you an idea.
Yes you can do all that. You will need someone with knowledge in wordpress themes and plugins but it is possible. The beauty of wordpress is, that you can write "bare" php code, and the small amount of functions to interact with wordpress are well documented.
Wordpress itself, is structured "simple" (compared to fancy tools like magento for example). So all it manages, are posts / pages / ... which, more or less derive from the same database object. You can add functionality to those things (for example, make posts cruise ships and other posts to shore excursions) or you can add your own database structure on top.
The theme system is bare php code, so you dont have to crawl through a thousand lines of xml codes to adjust little things.
Wordpress power derives from its simplicity of the "core wordpress" and the feature volume based on all those plugins. I believe alot of people would say, that you should go for a custom solution (based on symfony for example), or a CMS that already comes with more of your desired functions (like magento which has the checkout / paypal included), but I (as a wordpress fan) would see no problem to take wordpress.
I have never failed to find a plug-in to do what I needed! I manage three WordPress sites - although none of them is commercial. (Yacht Club, Cycling Club and Political Party EDA).
There is a plug in that allows PHP on any WordPress page, but it means that the Editors all have to write using the text (HTML) view rather than Visual tab. I found that useful for some of my pages - and I'm the only "Editor."
There's also a plug-in that allows you to code PHP in Widget. That doesn't have the above disadvantage.

WordPress website white labeling?

We have many (hundreds) of clients that require basic, content-oriented websites. We are currently using simple WordPress deployments for these clients, but would like to make things more simple.
Is there a tool that exists that will let us white-label, or "re-use", a basic WordPress website and simply injecting some text and images into it to create a whole new website?
The process would look something like:
1. Have new client that needs website
2. Gather some client info (phone number, images, biography, etc.)
3. Inject this info into a previously created WordPress "template" site
(we would use the same template for all clients)
4. Pick a WordPress theme
5. And done. We now have a rebranded WordPress site for this client with minimal work
done.
Step 3 is where we need help? Is there something that already exists that can do this? If not, what is a good method to do this "injection"? We were thinking just creating a small app that would go through the template WordPress site and do a find-and-replace.
Perhaps it would be good to simply write a plugin which would allow you to gather exactly what info you need in a settings panel there, then inject the information into whatever theme you're using from there.
So it would be a relatively simple step as you create new sites to install the plugin, use it to add information, etc. (Perhaps if most of it is client information, it stores the information with admin user information).
Well if you want to be able to re-use your branding, you could do them in your theme's function.php, so its kind of "portable"
For example, when I re-brand a wp site, and customize their wp-login. Change logos and stuff.
and things like, hide menu of theme-editor, plugin-editor, etc
all goes together, and I put the codes in the functions.php

Integrating Drupal and WHMCS

I am just wondering if there is any hook to integrate WHMCS database with my existing Drupal site.
WHMCS has its own CMS and so as Drupal. I have used the same html twice for WHM and also for Drupal hence the problem is that I have to change twice if there is any design update.
The answer is no, there is no such thing.
A hook, in Drupal is not something magically to integrate anything. A hook is merely a architectual concept to allow code being ran on several occasions. A hook is not what you are looking for.
You will need to implement each and every piece of integration with Create, Read, Update, Delete synchronisation. A user in Drupal gets updated, that should fire code wich updates the data in your other CMS's database. A piece of content is created in your WHCMS, then it needs to become available in Drupal too. And so on and so on.
So, you will first need to define very clearly what you want to integrate and share between both. If it is only the session (single sign on) there are several solutions ready to use. But if you need all content, their comments, search-results and so on to be shared, you have a long way to go.
The reailty with integrating two CMS's entirely, is that you often need more then the sum of the codebase of both CMSs as gluecode: it needs such great amounts of complex integration and synchronisation-code, that in the same time you had probably written both Drupal and WHCMS from ground up. My advice: don't even try.
Hooks are mainly for CMS operations (creating/updating/deleting content). Sounds like you just need to share the theming from the CSS and header/footer HTML across both systems.
You can switch Drupal to use the Smarty template engine: http://drupal.org/project/smarty
You may then be able to create a Drupal theme that imports the header.tpl.php and footer.tpl.php from the WHMCS theme.
You may need to remove some of the Smarty markup and variables from the WHMCS side to simplify the header and footer to the point they can be used with Drupal (if you can make the header and the footer pure HTML, you may not even need to use Smarty on the Drupal side), or write a lot of preprocessing code on the Drupal side you may be able to populate the template variables with values from the WHMCS database.

Migating from CakePHP to Drupal, functionality question

(I've posted this on the drupal forum too btw)
I'm converting the company websites to use Drupal, or at least trying to check that its going to be the best way forward. I have a background in PHP development, and I'm currently using the CakePHP framwork. I've built this site (not my design) and I can see how to replicate most of the functionality using Drupal, most likely using the CCK module.
http://preview.tinyurl.com/yk6u8mt
As you can see from the homepage:
A user chooses a country.
The country is passed using an ajax call to a script that decides which phone is best based on 'in country' network coverage.
A div is shown recommending the visitor the best phone for that country.
I'm wondering how to go about this in Drupal, I'm definitely not after a step by step guide, I just want to know if this kind of thing is possible with Drupal, and what approach to use.
If someone can help that would be superb. Thanks.
Okay, so you've got a path you're defining in hook_menu, which is where your form is being presented - or else you've got it set up as a webform in a node, that could work too.
Either way, in your form you're going to be using AHAH - check out http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.html/6#ahah and http://drupal.org/node/348475 .
Basically, you're going to define another path in hook_menu that's of type MENU_CALLBACK, and which will receive the country as input, and then will return the div that you'll display on the screen.
One core example of AHAH that may be useful to you is where you're entering a password and it lets you know if the password is secure enough - check that out.
Edit: There's also some good examples at http://drupal.org/project/examples.
I would look into using CCK and views. you can set up filters for the views. If filters don't work, you have the ability to include php code. I have also successfully added jquery code in the header of a view through which I was then able to have my view filtered by what is typed in a text box.
Coming from CakePHP using Drupal is a pain in the a** - even more for developers.
It's application structure might be designed to ease extensibility but this only means you have a system to enable your own plugins and themes.
While modules are basically the M+C-part the themes are the V-part of an MVC-application. The problem is that this seperation is not very strict in Drupal - in fact you have to break it sometimes in order to make things work (e.g. you have to include a theme_mymodule_myfunction() into your module as default output which you then can override with your theme using mytheme_mymodule_myfunction() ) And don't even bother looking for classes ( see http://drupal.org/node/547518 ).
Also there is no real link from a module to a theme. On many occations this is a good thing as you can switch modules and themes seperatly without creating a problem. For application builders coming from CakePHP (or any other framework) you often feel a lack of "wholesomeness" - you create parts for a base software and have to live with it's drawbacks.
IMHO I wouldn't recommend this step. Drupal is fine if you have to manage a website and might add a few modules to add neccessary value (image gallery etc.) but I definetly don't recommend it as a base for a customized web-app.

Template system in CodeIgniter like wordpress?

I'm trying to build a template system in CodeIgniter like wordpress. Does anyone have some links or tips to share with me on this matter?
I would like to create several functions that I can call from those php template pages like in wordpress. For example to display the comments from an item or loop through something, or even a tag_could.
the views folder would containt the different template folders & files.
and yes there is smarty, but no I don't want to use it.
Have a look at my Template library. It supports modules, themes, partials and layouts so you can create one main layout for each theme then have modular views if you wish.
While you are not a fan of Smarty, you might be interested in trying Dwoo. They are both very similar but Dwoo has the advantage of not sucking major donkey balls, which is Smarty's main downfall. I have written an extension for the CodeIgniter Parser library to get it to use Dwoo, which integrates perfectly with my Template library.
Between the two you can make pretty powerful, theme-able MVC applications.
Check out
http://www.williamsconcepts.com/ci/codeigniter/libraries/template/index.html
Template is right for you if:
You feel like using views can be clunky, especially when "embedding" views.
You don't like calling header, footer, and other global views from every Controller method.
You prefer having one "master template" that can be changed for any controller in order to meet unique application design needs.
You don't want to drastically alter the way you interface controllers and views.
You like clear, thorough documentation on par with CodeIgniter's User Guide.

Resources