php

Strange program call error

I have a problem. I have made a script to convert a given HTML page (url) to a given jpg file using html2image: #!/bin/sh cd /absolute/path/html2imagev3 LD_LIBRARY_PATH=.:/usr/lib:$LD_LIBRARY_PATH xvfb-run ./html2image $1 $2 It is then run like this: /path/to/convert 'http://www.google.com' /tmp/google_screen.jpg This works without...

PHP - forward a page on best way!

Possible Duplicate: How to make a redirect in PHP? Hi! How do i forward a page on the best way? Should I use the header-funct. or should i use HTML (meta-tags) to refresh? I hope some experts could give me some advice at this point. Thanks! Btw, the forwarding is made inside an if-statement if that could be to some problem? ...

Yii: Customize the results of CAutoComplete

Hi guys! I need to make a dropdown list using CAutoComplete. Everything is set and works fine, here is my code of the action: <?php public function actionSuggestCharacter() { if(Yii::app()->request->isAjaxRequest && isset($_GET['q'])) { $name = $_GET['q']; $criteria = new CDbCriteria; $c...

Pass xml data to a swf object

The Context of the Problem I'm working on a rotator banner in flash. I use an external xml file to pass the banners info (like info-text, link, image-path, priority, etc). Everything is going well so far. I'm loading the xml something like this: var bannersXML:XML = new XML(); bannersXML.ignoreWhite = true; bannersXML.load("myBanners.x...

strategies for managing long class files in php

I've got a bunch of functions that I want to move into a class. They're currently split into a couple of fairly long files. I'd prefer not to have one 2500 line file, but as far as I can tell, you can't use include to split a class up into multiple files. In theory, I could group the functions in different classes, but they're closely re...

PHP to work across templates in Joomla

I'm trying to get a small set of php functions working that i need available on the entire page. I'm including them in my index.php main template via require_once "my_functions.php". They work in the index.php template; that's the good news. We have a plugin that let's us write php in our content items with the following syntax: {sour...

Warning: gregoriantojd() expects parameter 1 to be long, string given in on line 19

each time i try and pull out a date from row caseOpen in tbl_accident I am greeted by the following error... Warning: gregoriantojd() expects parameter 1 to be long, string given in on line 19 what could be the problem? the date in caseOpen has the format dd/mm/YYYY <div style="paddingz: 5px;"> <table width="100%" height="...

PHP Echo Timezone based on GMT offset

I have an application that stores GMT time data in a MySQL db like this: 2009-12-16 15:27:47. The user's timezone offset is stored in another column like this: -6 The above timezone is GMT-6, which is CST. Is there any way I can echo CST (i.e. - date('T")) from the GMT offset data? Note: I should also add that the application global t...

PHP - foreach how to store the array to mysql

I want to store array into mysql db something like this item_row = nike,adidas,puma qty_row = 1,3,2 total_row = 100,200,150 foreach foreach ($_SESSION['order'] as $values) { $item_name = $values['item-name']; $item_qty = $values['item-qty']; $item_price = $values['item-price']; } Let me know how to do that?...

Wordpress hiding Post Div

I wanted to know how to make it possible that if there is no post i would like to be able to hide the DIV that controls the latest blog post only having them appear when someone post somethign on a blog.. Somewhat like a position in joomla but in this case i am using wordpress ...

What would be a good way to direct users to different URLs from one link?

I've been working with PHP for a few months now. I've put together a small PHP site with three groups of users: admin, teacher, students. Here's what I would like to do: Students are in different groups. I have five different groups now. Each one of these five groups has access to a link that directs them to an online classroom. We can...

Adding days to specific day

Many examples are about adding days to this day. But how to do it, if I have different starding day? For example (Does not work): $day='2010-01-23'; // add 7 days to the date above $NewDate= Date('$day', strtotime("+7 days")); echo $NewDate; Example above does not work. How should I change the starding day by putting something else ...

Zend Framework How to list form elements using partialLoop

Hi everybody I'm new to Zend Framework and not sure if this this posible. I want to use partialloop for creating a table with the form fields. I'm using this code in the view: <!-- code in views/scripts/request/edit.phtml --> <table cellpadding='0' cellspacing='0'> <tr> <th>Cliente</th> <th>Descripcion</th> <...

PHP cURL multiple calls vs simplexml_load_file

If i am making multiple calls to an api on each page in a web app, is cURL right for me, or is using simplexml_load_file with the URL wrapper OK? Will opening, making the call, and closing the cURL connection multiple times negatively affect the app? ...

How do I use the Posterous API for reading posts?

I want to extract the blog content from my Posterous blog using the API call of http://posterous.com/api/readposts?hostname=NAMEOFSITE When entering the above address in a web browser, it returns the content in XML format. What I'm stuck on is how I can use or store this content in an array so I can output it using PHP in the format th...

php insert sql function

Hello everybody, I want to create one insert function in php, which I will use to insert data into database. Of course all inserts are not the same, some use one table others use other, tables have different column numbers etc. What is the best way to do this ? I'm currently on the web page for member registration, now I don't want to ...

Content Dispostion header set in PHP not working with Firefox

I have a form button that submits the data to generic script (the same page that the form is loaded from, index.php) and if the right POST variables are submitted to that script, it returns a PDF for the user to print (with the relevant form info loaded, and other DB info, etc). The problem is that no matter what I set the content-type ...

get form values into array in php

Hi, Is it possible to get form field values into array? EX: <?php array('one', 'two', 'three'); ?> <form method="post" action="test.php"> <input type="hidden" name="test1" value="one" /> <input type="hidden" name="test2" value="two" /> <input type="hidden" name="test3" value="three" /> ...

Best way to load only specfic functions in PHP.

I'm writing my own content management system for a personal website, it's going to be low traffic, but I'd like to use the best practices for my future knowledge. My plan is to have separate sections, basically the first non-root directory, will have it's own script and will directly control all its subpages. I want everything to be con...

Odd code added just before close body tag

My client is reporting that code looking like this has been automatically added to the end of all PHP files (just before the close body tag): <b1><!--J5qN2aS2eNoNycENgCAMAMCNqEoUnYZA04DRUgI1rC+f+xxwUdDQEuliwe5u3U+wzm3HBWMMkxpR0Qnmr2E2KAyDIqAUnQGM3H0NiXwUed67q6m5/t4jHpA=--></b1> He tried manually deleting that line, but of course it re...