Using Simple HTML DOM Parser to build mobile site - php

What drawbacks are there in using "scraping" techniques and tools like http://simplehtmldom.sourceforge.net/ if you need to display content in a different template and domain like "m.mysite.com" for a mobile version of your site? I understand that the traditional way to do this is to hook into your database and write SQL queries to access what you need.
However, my SQL knowledge is lacking and the DB is quite complex using a custom CMS (I didn't build the site originally) . Everything that I need is on the front-end and I can access each piece with Simple DOM and place it in a jQuery Mobile template.
The only drawback that I can see is that if someone changes class or an id on the main site it could break the mobile site. But what are the other implications? Would a mobile site built like this be slow to load even if the main site it is based off of loads fast? Anything else I'm missing?
Also, isn't this basically how services like http://www.dudamobile.com/ work? They certainly don't have access to your DB.
Thanks for any help.

If I were you, I would develop a high level API and use it with templating engine. Once you do this, you have the API, which you can always use easily to obtain data from your database. Also, using templating engine gives you the ability to display the same information across different templates.

Related

Which CMS for having a mixture of CMS-enabled pages and my PHP programs?

I'm creating a website which has a public-facing side, which I want selected users to be able to edit like in a CMS, but I also want to create a private intranet side which is made up of pages written in PHP by me to perform certain functions, but are not part of the CMS as such.
So basically I want:
- Some CMS-ified pages which are user-editable
- Some custom pages which use the CMS templating engine, authentication etc..
Which would be the best CMS for this?
Drupal is really good when you need this kind of flexibility. You can easily configure it to link to other pages via the menu system and TBH, it's so flexible, you'll find that anything you would want to hand code for the intranet can be done by installing and configuring existing third party modules, with the option of writing a custom module if you really have to.
We do developments like this and bring all of the intranet stuff into Drupal by putting code into a custom module and having the functions called by simple forms made in Drupal. To see data from internal DBs, tell Drupal the DB details in the config, then use the views module to make lists etc.
Not sure if it's the best, but Drupal is a very good candidate based on your description.
Your custom pages can be implemented in a module (PHP code). Specific URLs can be declared as being handled by your module and the rest of the CMS will not get in the way if you don't want to. From the point of view of your code, Drupal can be seen as a kind of framework.
I might use drupal. From what I've done with it, it seems very customizable. It's more flexible and seems more clean and secure than something like joomla. There are plenty of addon's. I haven't done enough with it to get to the point where I was interfacing my own PHP pages with it, but if I had to try anyone that's what I would go with.
I, however, personally just make my own CMS. It might be more work, but then everything is the way that I want it to be. It depends on how much you want them to be able to edit. For example, I was making a website for a shop, and so I created a place where they could add and remove items, which wasn't that difficult, especially since it was database based. To be able to do things like change menus and appearance and such might be harder...probably look towards something like a CMS.

Lightweight codeigniter/php cms that easily plugs into site code

I have another codeigniter CMS suggestion question. Pretty much I am just looking for a CMS that allows my client to easily add in content that doesn't necessarily need to be tied into a page. I pretty much want a MYSQL database with a gui that allows the client to upload content to certain tables in the db. I don't want any themes attached to the cms as the site code will all be custom built and I would prefer to write all the db calls to pull data for specific pages. I just need a way for the client to easily upload data to a table where I can create a model to pull the data.
I have heard of FuelCMS, Ionize, and PyroCMS but all these seem like they have too much. I am looking for a pretty barebones db that has a gui and good documentation for the api's. That's all.
Thanks!
I know you wouldn't think of ExpressionEngine as "lightweight" but from the perspective that you are speaking, it is...
It allows complete control of content separate from any design's or concepts of "pages". It's power is that you define "objects" or channels that contain specific information that you then take and construct the pages around. Channels are a more user friendly concept of the MYSQL tables you're talking about.
DownsideYou get good support because it's not free, but and worth the money.
It's module development pattern is familiar if you are a codeigniter developer also.

jQuery Ajax PHP JSON

Hi I'm just after some advice/input.
I'm developing an application that has a MySQL backend, it has HTML pages that use jQuery to access PHP pages returning the data from MySQL in JSON.
Now, what I need to know is there a disadvantage to working like this.
The main advantage I can see that I can seperate the presentation layer and data access layer. Therefore it speeds up development once I have setup the objects in PHP.
One of the main disadvantages I can see (or I think I can see) is that Google won't be able to see the results inserted by jQuery Ajax/JSON.
Open to any advice, thanks in advance.
Regards, Andy
I strongly recommend that you enable your application to work for users without JavaScript support as well. If you do that you'll have a quick application for your visitors with JavaScript, you'll have a working application for visitors without and Google won't have any problems indexing it.

Drupal (or some other CMS) or a simple MVC-based PHP framework like CakePHP?

We have a dashboard that we'd like to build for our customers. This dashboard displays various statistics about one or more of their (business) Facebook Pages. The statistics are pulled from Facebook using their FQL and Graph APIs, stored locally in a MySQL database, and queried/derived/presented to the user based on dates requested and some other variables. Additionally, users will be able to take action on various items (e.g., reply to wall posts, etc.) using their JavaScript SDK.
One of the external developers we spoke with -- currently don't have any resources within the company with time to work on this -- has proposed building the system around Drupal. Now I'm a fan of CMS systems for web pages, blogs, etc. but using something like Drupal did not come to mind here as much of the functionality seems irrelevant.
Can someone please let me know the advantages and disadvantages of using Drupal for custom development work like this? While we're looking for an elegantly designed system that our developers (as we hire them) can maintain and extend over time, I'm not so sure a CMS is the way to go.
Thanks!
I wouldn't recommend Drupal at all for something like this. You don't really need a full-blown CMS like Drupal, and it would be pushing it to say you should use a framework such as CakePHP.
Personally, I would build this as a standalone app. I see no reason to get a framework involved unless you plan on expanding the APP considerably in the future.
Drupal is often called a content management framework because it's so extensible, and certainly you could implement the dashboard in Drupal. However, I would question the developer thoroughly about their rationale for using Drupal before consenting to it.
Everything you specified sounds like custom development and has nothing to do with content management. You're manipulating data from Facebook, not a database of content produced by an editor. Your data is custom data, not simple Drupal node data (title, body, etc). I would go with a general Web application framework such as CakePHP. That way you get templates and user authentication without all the CMS overhead.
While I don't think that Drupal is really necessary in this case, I think that the final decision lies with what the strengths of the contractors you are using are.
If Drupal will allow them to finish it more quickly, and more securely (due to the fact that Drupal will provide well test user authentication, used by many), then I would say let them go with Drupal.
That said, I do agree that Drupal sounds to be more than what is necessary, and there would probably be far less cruft if you used a simple framework.

Best approach to developing a cross-browser JavaScript widget that populates from a MySQL database?

I'm currently researching the best way to approach building a JavaScript widget someone can embed on their site, which would retrieve and display information from an external MySQL database.
The gist of the widget would mimic the needs/functionality of Twitter's widget (http://twitter.com/about/resources/widgets), where it uses some combination of JavaScript, PHP and/or AJAX and retrieves information from a MySQL database with secure (or at least somewhat safe) cross-browser access. Does anyone have thoughts or ideas on the best and most reliable way to approach something like this?
Here is a great guide to building a cross-domain widget: http://alexmarandon.com/articles/web_widget_jquery/
The hard part is the Javascript side; the server side can be written in PHP, or Python, or Ruby or whatever. Your google search should include the term "javascript widget" to get more articles like this one.
Should be simple. Encapsulate your widget entirely in a JS file if possible (minus images) and use AJAX for calling a REST or SOAP (probably want to stick to REST) webservice for any data access you need.
IFRAME, just use a iframe. you have
native sandbox
control over your environment
no updating your widget for your users if there is a new browser. You just update your code in your iframe.
Everyone uses this method ( Google+, Youtube, Facebook, Twitter )
its a win win situation.

Categories