How to read/write xml files using Drupal 6 - php

I would like to know how can I parse XML files and perform read write operations using Drupal 6.

There is no API for this in Drupal -- use the SimpleXML extension from PHP. It works wonders.

It depends on the specifics of what you need to do. Modules such as Import / Export API, Views Datasource, XML Parser, and others may be useful, depending on what exactly you need to accomplish.
Also, this XML Parser for the Feeds module looks promising.

Drupal is a PHP application. There is no specific XML API in Drupal and any PHP one can be used in a custom module for a specific user case or feature. There is a large collection of XML APIs in PHP. If you have experience with jQuery, look also at QueryPath and the QueryPath module for Drupal.
You will need to create a module to embed your custom PHP code in your Drupal site.
As pointed by Matt V., there is a lot of modules in Drupal that deal with XML. Some may fit your needs and avoid you to write any custom code.

Related

Drupal modules be used without Drupal

Problem, can I use Drupal modules in my own PHP application? ( without setting up Drupal ). I searched a bit, there seems to be .zip file for the module, init where there are .inc files.
Is it possible to use this without setting up Drupal ?
I need to configure Solr search, Drupal seems to have a search API and thought I could use it.
You can use the PHP solr library, instead of trying to hitting your brain on drupal modules files. With few extra code you can able to do indexing, searching ,etc. There is a good library https://code.google.com/p/solr-php-client/ .
There is a good tutorial on Solr installation and usage in PHP. http://www.ibm.com/developerworks/library/os-php-apachesolr/
You can not use Drupal modules anywhere outside from Drupal.
But, you can download the modules, and extract the main php functionality to make it work with your business requirements.
Some modules have also open frameworks that can help you.
Hope that this helps.

Print docs in PDF format in Yii

I have made an application in Yii. Now as per my application requirement I have to make them print in PDF format. I searched over Yii docs but did not got any docs about converting file into printable PDF format. So any help and suggestions will be highly appreciable.
Look into WkHtmlToPdf:
http://code.google.com/p/wkhtmltopdf/
It uses Webkit's rendering engine to make PDFs from HTML / CSS. It's the best library out there that I've found and I've done a bunch of research.
Edit:
Mike on the Yii forum has already built an OO wrapper for WkHtmlToPdf and just released a Yii extension for it.
I have recently used MPDF for a project. It allows you to convert HTML output into PDF format. If you are looking for something simple this might be what you are looking for. Personally, I find it easier to work with HTML/CSS for layout than PDF boxes. I am not sure just how well it scales with complex layouts, though.
Yii also supports using Zend modules. You can use Zend_Pdf if you so choose.
See this documentation page on how to integrate third-party libraries with your Yii code.
Either way, as has already been mentioned, there are tons of PDF libraries available for PHP.
You should search for php libraries to do that. Link to one of them - http://www.tcpdf.org/
I have had great success using fpdf - http://www.fpdf.org/
Unfortunately this feature is not part of Yii. You can try TCPDF, though. http://www.tcpdf.org/
TCPDF lets you parses your HTML output to PDF document. The PDF document can be output in your server or to the user as a direct download.
Hers the extension to create PDF files.
Yii2-PDF

Are there any limits in using a PHP framework?

I'm planning to use a PHP framework (Yii) for my future project due to the amount of features that it would contain. I have done a few PHP projects in the past and I now realize how disorganized they can get after a while, even if you use a proper directory structure. So, basically, I'm wondering if everything in PHP, can also be done in a framework without tweaking the core framework itself. Will there be any limits? Can I use PHP classes like geolocation, phpexcel or phpthumb: http://phpthumb.gxdlabs.com? Preferably Yii. Thank you!
I'm wondering if everything in PHP, can also be done in a framework without tweaking the core framework itsel
No, every framework has its limits but some are more flexible than others. For example, some frameworks don't allow you to connect to multiple data-sources with their model implementation. But if it's a decent framework, you should be able to extend or swap out those shortcomings with your own or another implementation.
Can I use PHP classes like geolocation, phpexcel or phpthumb
Yes, most frameworks allow easy integration with other libraries. I found a link showing how to integrate phpexcel with Yii:
http://www.yiiframework.com/wiki/101/how-to-use-phpexcel-external-library-with-yii/
Yes All framworks have proscons, but it's very important that how we will user them, i.e cakephp provide the helper class to create html and form but no need to use each and every time that because it will make slow your application
CakePHP have also cache memory limitation, we found in one popular auction script.

External documentation for PHP, no DocBook

I need a documentation system for a PHP project and I wanted it to be able to integrate external documentation (use cases, project scope etc.) with the documentation generated from code comments. It seems that phpDocumentor has exactly the right feature set, but external documentation must be written in DocBook which is too complex for our team.
If it were in python, sphinx would be just about perfect for this job (ReST is definitely simpler than docbook). Is there any way I can integrate external ReST documentation with the docs extracted from phpdoc? Should I just separate the external documentation (eg. use ReST for external and phpdoc for internal)? Or do you have a better suggestion for managing the external documentation?
You can convert ReST to DocBook using pandoc.
convert wordpress posts in DocBook style. here is the sample.
http://hashfold.com/techfold/wordpress-how-to-generate-docbook-style-posts/

ActiveScaffold for PHP

Ruby on Rails has a bunch of plugins which extend the normal scaffolding:
Lipsiadmin
Hobo
Streamlined
ActiveScaffold
Does the PHP community have anything similar? phpmyadmin is great, but it doesn't have any way to control the presentation of the data. You always get all of the data in its presentation format. These Rails frameworks are a little more user friendly.
Edit: My original question was not very clear. I'm not looking to compare PHP and Rails. I'm also not looking for an all purpose general framework. I'm looking for something just like the four pieces of software I listed above, but written in PHP. The admin software I listed above generates a crud interface for you based on your configuration. The configuration includes which tables you'd like to show, what operations you can do to the table, and who can see the information. The software does the rest, from writing the SQL to processing the request to generating the interface.
I would look at Zend, CakePHP, CodeIgniter or Kohana. See if they have an addon or plugin that can do it.
The problem with the four pieces of software you listed is that they extend Rails. When you say "PHP," there is nothing to extend in the same sense. (I really doubt you want a PHP module that does this.) You don't need a PHP addon, you need a [framework] addon.
Any of the frameworks I or Jonathan listed are similar to Rails. Kohana in particular has an addon module called Auto Modeler that may do what you need.
have you looked at pear: http://pear.php.net/
It's important to stress the difference between a language and a framework here. PHP is not itself a framework with modules. PHP is a language, like C or Python.
There are several website frameworks that have been written in PHP. The most popular would probably be Drupal though there are several that I've looked at over the last year that seem similarly capable:
CakePHP
CodeIgniter
Joomla!
Symfony
Zend
PhpMyAdmin is not a module or a framework. It is a separate, stand-alone web application for database administration, written in PHP. It won't be a component in any strategy for presentation of data on a website.
Symfony may be a "general framework", but it has scaffolding you can use as a complete application if your needs are simple. You define your model in a YML config file, and can then generate CRUD modules based on this model. The code generation is also customizable by editing other YML config files. All without writing any PHP code. But should the need arise, you have the option to extend the scaffolding with PHP and the complete framework.
See the Symfony docs on code generation.
A framework called ATK also claims a good code:functionality ratio ("An application in 10 lines of code").

Categories