php5

Is it really that wrong not using setters and getters?

I'm kind of new in PHP. For some reason in other types of programming languages like JAVA I have no problem with using setters and getters for every single variable, but when I'm programming in PHP probably because it is so flexible it feels kind of like a waste of time. It feels simpler to just set the class attributes as public most of...

Getting database values into objects

The thing is that you have classes and then you have the database data. When you create an object how do you set the objects properties to contain the data in the database ? I saw something like this and I'm wondering if this is really the best way to do it. I'm sure this is a fairly common issue, but I don't know what are the most acce...

PHP - reliable deliver of documents inline to the browser

Is there a library or good documentation somewhere on the best way to reliably deliver documents in a users browser regardless of OS and browser. I'm mainly looking at PDF, office (2003 & 2007) and scanned images (.tiff) It seems that you always have to set different headers depending on the browser and the type of document being deliv...

Using Fusion Chart in PHP and rendering in Smarty Templating Engine

My issue is not able to render the chart in .tpl file. The following code is the example taken from Fusion chart document check for reference <?php include("../Includes/FusionCharts.php"); //Create an XML data document in a string variable $strXML = ""; $strXML .= "<graph caption='Monthly Unit Sales' xAxisName='Month' yAxi...

Cannot get PHP working on Leopard again

I had the default Apache2.2 and PHP installation working on my MacBook Pro, but it stopped working at some point. I've read many online articles to try and fix this problem, but none of them have pointed out anything that I am not already doing to get PHP working again. I am completely stumped: My basic Apache configuration appears to b...

how can I read the contents of stdin (up until EOF) into a string in PHP?

how can I read the contents of stdin (up until EOF) into a string in PHP? ...

PHP character encoding problems

Hello guys. I need help with a character encoding problem that I want to sort once and for all. Here is an example of some content which I pull from a XML feed, insert into my database and then pull out. http://pastebin.com/d78d24f33 As you can see, a lot of special html characters get corrupted/broken. How can I once and for all sto...

In Kohana, can you trigger a 404 error?

I have a controller called articles, which creates the articles model which gets the relevant data from the database. I want to, if the method I call returns false, to trigger a 404 error. This is what I have so far. $articleName = $this->uri->segment('articles'); $article = new Articles_Model(); $data = $article->getArticleUsing...

Dynamic Javascript File newline & carriage return

Hi All I am building a JS page dynamically with php using .htaccss to make .php into .js All works well apart from the output of the JS. IE $data = array('one', 'two'); foreach($data as $d){ echo "document.write('This is a test for array item ".$d."'); \r\n"; } Problem is it outputs it all on one line ie document.write('This ...

XSLT character encoding problem

Hey guys, I'm using XSLT and having great success, just got a couple of problems. Warning: DOMDocument::loadXML() [domdocument.loadxml]: Entity 'Aring' not defined in Entity Basically for some non-standard characters I am getting the above type of error. I really want to fix this once and for all. I know about character mapping but I ...

How to check if a deep array value is present

I want to quickly identify if a key is present in an array, to avoid throwing an error. For example, I might have an array like this $arr['f']['b']['g'] = array( 'a', 'b', 'c', ) ; Or the array might not have any variables in $arr['f']['b'] at all: $arr['f']['x'] = array() ; How can I avoid repetition in a test when referencing th...

Hunting for PHP5 incompatibilities. >.>

Something in here is incompatible with PHP5, but I am totally lost as to what. I have an .htaccess file on my web server that has the line "AddHandler x-mapp-php5 .php", as it is required by just about everything else on the server and it defaults to PHP4...however; I need this one script to work, but it only works on PHP4. Any idea wher...

How do I print the html element hidden in Zend_Form_Element_Select

I have a form which I create manually (a lot of JS in it...). I am using the Zend_Form classes in the server side to validate input and some more. Is there a way to get a Zend_Form_Element_Select (or any other element) to be rendered without rendering the entire Zend_Form object? ...

Choosing the right PHP framework

Hello guys, I want to start working on a project and this time around i want to make sure of a framework and see its like. i am having a little problem choosing a framework to work with. At the moment one of my motivations of using a framework is the MVC pattern. I know how useful it is. However, the framework i want to use must be an ...

How to remove dd and dt html elements when rendering a Form element in ZF?

I am rendering in my view a Zend_Form_Element_Select. $t=new Zend_Form_Element_Select(....); ... ... echo $t->render(); I get the drop down and the options correctly, but I also get the select element wrapped in <dt> </dt> <dd>[elm]</dd> How do I remove that decorator? ...

How do I turn tld.com/bures/oceanfront into tld.com/articles/view/bures/oceanfront in Kohana?

I'm using Kohana 2.3.2 Most, if not all, of the links on my site are to articles. My controller is called Articles, and I have a method titled View. I don't want to prefix all my links with /articles/view/, so I'd like to set a default controller to handle all files. I've looked into using a default router, which made tld.com use the ...

How to change the value of a Zend_Form_Element_Submit

I have several forms which the only difference is the text in the submit button. I am trying to change the Submit text by changing it's value, but to no avail. $form=getForm()//get a full Zend_Form object with elements. $form->getElement('mySubmit')->setValue('new value'); .... .... $form->render(); //This will still put 'mySubmit' in t...

Can someone describe some DI terms to me?

I'm in the process of writing a DI framework for PHP 5, and I've been trying to find the 'official' definitions of some words in relation to dependency injection. Some of these words are 'context' and 'lifecycle'. And also, what would I call the object that gets created/injected? Finally, what is the difference between components and ser...

php5 soap client in wsdl mode how to access different svc endpoint than the one specified in the wsdl

I´m a newbie to soap with php5... I need to use a wsdl provided by a third party company, where, for testing purposes I´m supposed to use a different access address location for the service I´m needing, than the one specified in the wsdl document. Is there any way I can create my soap client in wsdl mode, and override the specified add...

How to keep table structure up-to-date

Does anyone have an idea for a scipt that can check an array/XML of table definitions with the current database tables and make appropriate alter/create queries to synch them? I'm currently using php5 and mysql 5. ...