Object and Ternary Operator PHP
Hello, I wanna make use of the Ternary Operator with an object. if($msg == 'hello'){ $o->setHello('hello'); else $o->setHello('bye'); How could I do that? Thanks ...
Hello, I wanna make use of the Ternary Operator with an object. if($msg == 'hello'){ $o->setHello('hello'); else $o->setHello('bye'); How could I do that? Thanks ...
Below is sample code to create a radio button element with Yes/No options in Zend_Form. Any ideas on how to set the required answer to Yes, so if No is selected, it'll fail validation? The code below will accept either Yes or No. $question= new Zend_Form_Element_Radio('question'); $question->setRequired(true) ->setLabel('Are you sur...
What are some recommended WordPress plugins that make building an online user manual more effective? I've been browsing the plugin directory, but was wondering if anyone has already been down this path and could make some recommendations. Edit: Doh! Using a wiki didn't even occur to me until these responses! I started building a site us...
I'm using PHP5 to create XML files. I have code like this: $doc = new DOMDocument(); ... $xml_content = $doc->saveXML(); The problem is that created XML code starts with a root node like this one: <?xml version="1.0"?> But I want it to be like this: <?xml version="1.0" standalone="yes" ?> I guess I need to call some function on ...
The problem that I am having has to do with the need to keep some urls of a website protected by https and the rest kicked to http. Normally, you have $_SERVER['HTTP_HTTPS'] or $_SERVER['HTTPS'] (depending on your flavor of Apache). You also can check the port - it's 80 for normal traffic and 443 for https. My problem is that the cert...
I have dumped Zend Framework files in "home/hotbuzz/public_html/include/zend/" My hosting : linux I want to load it in my script. Whenever I load I get this error. Some info: I asked about my Zend, to hosting guys they said its located in "usr/local/zend" But I want to use this home/hotbuzz/public_html/include/zend/ I had added ...
Dear All I have a PHP file going to write a two-dimensional array in javascript: <?php print "<script language='javascript'>"; print " extra[0][0]=new Array(1,'Bob',12);"; print " extra[0][1]=new Array(2,'Alice',18);"; .. // need to assign the extra[1][0],extra[1][1] so on. print "</script>"; ...
Hi, I have a bit of PHP code which I need to return an even number of results from a MySQL database. I'm using the mysqli extension to execute my query. My code is approximately this at the moment: //assume we already have a database connection $query = "SELECT id FROM movies WHERE publish = 1 AN...
Hello! I have a question about tables in MySQL. I'm currently making a website where I have files for people to download. Now I want to make a table in MySQL that will store the latest downloads, like if someone downloads file1.zip then it will add a row in the table with the filename and date, so that I can show on the front page "Most...
Hello, I have some mod_rewrite rewrites that correctly redirect the URLs to a script. From within the script, I want to go to a different file without causing another request/changing the URL. I have experimented with Location and meta refreshes but they are not as smooth as desired. Is there a way to change to the script or even retur...
Im trying to make a simple template system in PHP. I'm new to PHP, so it's nothing serious. I have some problems though: A regular include works: $variable = "test"; include("templates/news.html"); But this won't: This says $variable is undefined: $variable = "test"; getTemplate("news"); The Function: function getTemplate($tpl) ...
How do you start the Interactive Console for ruby and php ...
Hi, The following code is visual basic, .NET, ASP... all of the above? Can anybody tell me what these two "Regex.Replace" functions/methods will leave me with when "strCookies" is equal to the block of text below the two Regex.Replace functions? I believe the idea is simply to capture the "sessionid" code and then the "cadata" code with ...
So I'm trying to build a script that automagically prepends valid column names with its appropriate table prefix (e.g. "t." or "r.") $t_columns = array('id', 'name', 'label'); $r_columns = array('related_value'); INPUT: id > 1 AND (name = 'Hello' OR label IN ('World', 'Planet name AND label')) AND (related_value > 1 AND related_value...
I'd like to get a list of random products from the same category as the current product for displaying within the product view - so far all I've dug up is http://stackoverflow.com/questions/272818/magento-products-by-categories Does anyone know how to do this? ...
I am just starting out with the Zend Framework and I am a little confused but getting there. Anyway I have been reading the documentation for *Zend_Form* and was wondering about setting values for the form such as this: $form->setAction('') ->setMethod('post') setAction and setMethod were the only two options given and I was wond...
I am writing a web app in PHP, and it has come time to build an update system, one of the requirements is automatic updates, how should I do this? I want to do it without a cron, so I'm going to have to check for updates when requests are made to the system, should I do this only when an admin, with significant privs, logs-in, I think t...
The title kind of speaks for itself, are $_SESSION variables stored on the client or the server? ...
I was looking for a solution for client side printing of reports and pre formatted forms from a PHP web based app. Note that these are not printing of HTML pages. Rather nicely aligned fixed formated Receipts, Order Forms, Ledger etc. Something that I have though of. Using PDF: Is there a simple one click way to print the report from c...
The Apache module mod_autoindex generates "directory indexes" that show users a crude hyperlinked list of the files and directories inside a directory (when there is no index.html or other DirectoryIndex file). I have a directory on an Apache webserver where I want to provide an automatic directory listing, including the full filenames,...