Wordpress library / SQL queries to build new frontend? - php

I have a wordpress installation I'd like to get rid off. It's been constant work over the past year keeping up with various updates and changes and managing differenet plugins. I've realized I don't need that much functionality and would be perfectly happy with static pages. If I manage to drop the installation I could also speed things up a lot and integrate the content more easily in the rest of our site.
I'm trying to find a PHP or Perl package which I can use to easily query the existing WP DB. Basically, I want to keep the DB and throw away the frontend and backend to WP. Then I just want to add a very minimal layer of PHP or Perl code on top to show the posts in the DB including meta data.
In case there is no package that can make this job easier, is there some concise overview of the SQL queries I will need? I know I can go digging for them in the codebase, but maybe there is someone who has already done this. Googling around didn't immediately turn up useful results.

Maybe you want give a try to jekyll or octopress.

Related

I am building a small web application and i want to use JSON API to bring in Wordpress posts into my web app

So I am building a small web app. I have set it all up on Ubuntu and I am using Wordpress. I want to use a plug-in called JSON API to pull in content from my Wordpress blog in an easy to read form and I want this to be updated to say have only 5 posts at a time being the 5 most recent ones. I’ve looked around and I was wondering if someone could help me and give me an idea on how to go about this? I am a complete beginner I have no previous experience I have not started typing any codes or anything like that because I'm not sure how to start it.
You have a few options here, and which one you choose really depends on what works for you.
WordPress has a built-in API, but this is not a JSON API, it's XML-RPC. It's pretty feature-rich and won't require you to write any code (on the WP side) to pull posts. More info here: http://codex.wordpress.org/XML-RPC_Support
Read directly from the database. This is probably a faster implementation if you're reading from the same box. Simply connect to the database WordPress uses and query the posts table directly.
Find a JSON API plugin that suits your needs. It's difficult to recommend any as you seem to have specific requirements. Try some, and see what works for you. The downside to this is you'll need to keep the plugin up-to-date, and you're using third-party code - I'll leave it up to you whether you believe that to be a bad thing or not.
Write your own! It should be relatively straightforward to write a small script to pull in posts from the WordPress database and spit out a well-formed JSON feed.

Converting PHP site to Joomla

I have a large complex web site currently implemented using PHP and MySQL.
Some of the pages (about, contact us, etc) are largely static, but need to be updated from time to time. I'd like these updates to be able to be done by non technical admins, so I'm migrating the site to Joomla CMS. I've created a Joomla template to reproduce the banners, styling etc of my existing web site and have successfully reproduced the static pages by cutting and pasting into Joomla articles.
I'm now trying to embed my existing dyanamic php pages into the Joomla framework. I assume that I need to convert them into one or more Joomla components? I realize that I'll need to strip out the php code that currently generates banners, menus, etc, but I don't want to make major changes to these php pages, i.e. I don't want to re-implement them to follow an MVC pattern. I'm looking for a simple Joomla 3.2 hello world component tutorial. The tutorials that I've found are either too complex (i.e. MVC) or they're "too simple". By too simple I mean the component is not listed when I select Menu Item Type within the Menu Manager. Can anyone point me to any documentation that explains the minimal config that I need to include in a custom Joomla 3.2 component in order for the component to be listed when selecting Menu Item Type?
Also, should I create one big custom component to wrap my existing PHP application containing multiple pages("views"?)? Conceptually there the system could be considered as about 3 sub-systems, but there is some overlap between the MySQL tables used in these different sub-systems.
I don't need the implementation to be portable, i.e. I'm not trying to create a reusable component that others could use, I just need it to work on my site, using the least amount of work possible.
Thanks, Wayne.
I hope to clarify a bit and give you way out.
In response to your comment on #user3057084, the power of Joomla and its flexibility comes from it being MVC! If you want to wrap your existing code with little modifications, Wordpress will let you do all kind of nasty things! Nasty in the sense of mixing logic with data, i.e. copying and pasting your code and getting it to work quickly.
Joomla coding standards require that you separate models from views. And that you understand how the Joomla MVC implementation works. It will take longer, but you'll learn a useful skill that can and should be applied if you want to write portable maintainable code following Design Patterns.
Now about the way out.
Nothing keeps you from putting your raw php code in a Joomla view, including the database access. It's really ugly and I feel bad even suggesting this, but if it can be a small step towards using a great framework, then the end justifies the means.
The absolute easiest way for you in Joomla would be to create a template override (which you'll do from the admin with a few clicks in the template manager), then throw your code in, and it will run. Then, a little bit at a time, you might learn to separate the parsing of the input in the controller, store / retrieve the data in a model, and leave just the markup in the view.
But are you absolutely sure you need to code for this? There are thousands of (free) extensions out there that might do the job for you with no coding and little configuration, leaving you just a data migration to handle.
Have you had a look at Wordpress yet? In my experience, non-technical people find it easier to administer a wordpress website in comparison to a Joomla website.
When it comes to the menu structures,themes and contact forms and blogs - Wordpress takes the cake.
It would be worth your while to check it out? It might save you hours of frustration?

How do I migrate a PHP based website to Joomla?

I have a PHP based website, with database connections, form processing, etc, that I need to use a CMS on. I'm trying to use Joomla but after using it for 2 days and reading tutorials on it I'm getting the impression that it's designed to handle static content and that all form processing is to be handled by 3rd party extensions.
Am I getting the wrong impression? Is there a standard way to import a PHP website into a Joomla CMS?
I inherited a Joomla 1.5 site a few months ago, so I was in a similar situation to you - where to begin, with lots of questions about Joomla, its ethos, etc. What I've learnt in the meantime is:
Joomla is very heavily dependent on 3rd-party extensions. Some of these are good, some not so good - evaluation and caution is advised.
Joomla encourages the use of extensions, even for relatively static content. Whether these are full blown 'components', or 'modules', depends on quite how powerful/flexible they need to be.
The MVC architecture that underlies everything has its positives and negatives. On the plus side, if everything is done consistently, there is a good separation of concerns and - in particular - the template system offers good configurability. On the downside, very simple components/modules have an awful lot of complexity - e.g. just in terms of number of files.
Joomla is open-source ... sort of. If your familar with the open-source community, you might be a bit disappointed with Joomla, especially when it comes to 3rd-party extensions. Many of them do not embrace the open source ethos, and try to sell code and/or support so, to reiterate, choose your extensions carefully.
Writing your own extension is fairly simple, especially if you're familiar with PHP. Although the documentation isn't great, there are some gems - in particular, take a look at:
http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_1
http://docs.joomla.org/Accessing_the_database_using_JDatabase
When it comes to forms, I'm still undecided. The site I've inherited uses a third-party extension to manage them (mod_breezingforms), but it has its issues. If you have the luxury of trying out several alternatives, take it.
Run your development site in debug mode. Take a look at database queries. In my own experience, Joomla is very, very demanding on the database. For example, I have some pages that make hundreds of calls to the database with every request. Watch out for this.
At some point, you'll see itemid in the URL and wonder what on earth it is. It refers to a menu item. Menus in Joomla are a bit more general than you might think - they don't necessarily represent a 'menu' and they're quite important. For example, the built-in way to include content on a series of pages is for them to belong to the same menu item, so you might need to create 'fake' menus to house content.
Try MODx Revolution. You can insert your existing php form processors straight into Snippets with next to no modification required, or using the existing FormIt extra. Ajax is easy as pie.
Some docs to get your started:
Overview
Making Sites with MODx
Snippets
edit: apologies if it looks like I've tried to hijack this thread, somehow missed the fact the question is referring specifically to Joomla. MODx is definitely worth a look though ;)
There aren't many CMS's that can handle forms correctly (maybe only the very very generic ones, such as contact me forms, or shopping carts), but for any other purpose, you probably want to use your own PHP script to handle and process the form.
Nothing is stopping you from having a CMS on one part of the page, and your own PHP script on another.
I've once had a website with 2 different CMS's (Wordpress and Joomla), as well as some custom made pages. Slightly trickier to handle, but it's possible.
This question is very broad to answer. There are few step-by-step tutorial available on the internet for this.
From Joomla
Site Ground tutorial
If you follow this head start. You are sure to know a lot of joomla along way and convert your website to the joomla.
BUT, it is easier to build on Joomla rather than convert to it
The first trick to using Joomla effectively is to not over think things and use code that is proven so you don't have to work so hard.
Your existing content can likely be imported to Joomla just be exporting it to a CSV then importing back in to the Joomla article table.
Form handling is incredibly easy. There are dozens of form handling extensions, some of which do more than you will likely ever need. I use ChronoForms most of the time because it can be made to do basically anything once you learn how it works. I also like RSForms if you need non-tech people to be able to create forms on their own.
"Load dynamic data" in to a Joomla article is not very specific, but I'll take a stab at it. If you mean getting user submissions, then there are front end content submission options built in. If you mean loading data from another source, then you can generally use either a module or a plugin to get that data loaded either on the page or actually within the article itself.
Spend a little time getting to know how it works. Learn the difference between a component, plugin, and module and that will help you get a better grasp of what you can do. Joomla is an extensible framework, there's nothing you can't make it do and many things that are already built for you.
I would use JUMI, a Joomla component for embending your own PHP scripts. No scripts modifications are required!

Adding /Editing / Deleting existing code using an install script in PHP

I have wanted to create a PBBG creator. (Primarily text based games) However, I couldn't think of a system that efficiently allowed people to have the base code, then install modules into the game adding new features.
For example, the base code would consist of a simple home page and bare bones admin panel. Then you would install a registration module which would add new code and new database tables and a login module that would use the registration module's tables. Then from there you could install a Stats Module adding Health, Mana, etc., that would add more columns in the database for users. This would go on till you had a fully operating game made up of several different modules made by several different people.
What I want to know is if this idea is a good one. What are some issues that might appear? And how would I go about making it easy to add, edit, and delete code. Like if a Combat Module had a Module that modified the combat system, how would I go about determining what to change from an install script?
Also, are there any other open source projects using this system I can study to grasp the idea better.
I hope I explained everything well enough, if not please let me know so I can correct that. :)
Thanks!
It seems like you're describing code generation. If your question, then, is whether this is a good idea or not, code generation is a widely accepted "pattern" and should not be considered harmful.
Modifying existing generated code would increase complexity significantly, so what you probably want is some sort of intermediate representation of the code between when the user configures the PBBG and when it is generated. The intermediate representation should be a easily-modifiable full description of the system - modifying this would be a lot easier than writing a script to parse existing code and edit that.
Hope this helps, and good luck!

Looking for a easy integration PHP forum

I'm building a website with codeigniter (PHP) and I'm looking for a forum easy to integrate with my current database so users don't have to register twice. Moreover, I need to use the same html head and styles that in my website, placing the forum inside a div of <body>
Could anyone recommend me any simple forum application for my situation? Thanks.
I'm not aware of CI-specific solutions, but I've used a couple times MyBB and I can say it's really easy to integrate anywhere, as (at least in the 1.6 release, I haven't use it for some time) it's structure is easily moddable. I integrated it in a Joomla! website and in a custom one, and in both ways it's just a matter of reading the mybb_users table for access; it's quite a detailed table, so you can find almost anything you need for a registration table, like salt,password,timestamp of registration,email, and so on, so you just need to query that table and you're set.
As for the integration with CI I think the best way would be to place the whole forum folder and access it there; for the header, footer and other website parts you just change the relative forum template (layout are divided into subsets of templates, so you can change it easily and in details) and the user would not notice they are different applications.
You can also try and build a CI library for communicatin with the forum; they don't have an official API, but in functions.php and a couple other files I don't remember now (yes, 1.6 was mostly procedural, hope they have changed it now) you'll find all the relevant MyBB core, so building an API is straightforward; I once built own for Joomla! and was really easy. Moreover, there's This guy who wrote an integration for MyBB which is, in fact, a nice API; I don't know how updated it is, just check, but It's not difficult to port those files to a Codeigniter custom library, in case.
For database integration you're not going to find a forum that uses the same DB architecture as CodeIgnitor. What you can do, however, is alter your PHP registration scripts (for both CodeIgnitor and your forum) to add an entry in both member records.
Depending on your database you can also use Database Triggers to automatically update the other table when one is updated.
As for your layout, anything can be modified. Open source options will be the simplest, so I'd recommend phpBB for simplicity sake.
For more information on Database Triggers in MySQL, see here: http://dev.mysql.com/doc/refman/5.0/en/triggers.html
I would suggest using PHPBB forum or Wordpress with the BuddyPress plug-in.
I'm not quite sure how the integration with your codeigniter would be, but seeing as PHP is open-source, it shouldn't be too hard to crack open and find out.

Categories