Constructing arrays in Smarty PHP
Hi, Is it possible to construct an array in Smarty, for example I have tried {def $totalitems[0]=3} But that doesn't seem to work. Is it possible in Smarty? Thanks. ...
Hi, Is it possible to construct an array in Smarty, for example I have tried {def $totalitems[0]=3} But that doesn't seem to work. Is it possible in Smarty? Thanks. ...
Hi all, I am absolutely useless at regular expressions, so i'd appreciate your help. I have a string, such as this: $foo = 'Hello __("How are you") I am __("very good thank you")' I know it's a strange string, but stay with me please :P I need a regex expression that will look for the content between __("Look for content here") and...
I am currently developing a little ecommerce application to help me get to grips with CodeIgniter and programming in general. I have a 4 step checkout process. Customer name, email, shipping country Shipping option, shipping address Billing option, billing address Review and submit Currently I am storing all this data in the session...
I'd like to construct a grid, preferably with pagination built in, and do GETs POSTs etc from a right click submenu and have the grid update. We were using Ext but we found it do be too bulky for our uses. Can anyone recommend another library that is easy to use? Thank you in advance. ...
my select statement in php is "select * from table"; i use following php statement to display date & time of mysql field <?php echo $row['mdate']; ?> the result come like this 2010-03-09 16:59:18 i want to view the result i following format 09-03-2010 16:59:18 and i want to view the result i f...
Hello all, I'm attempting to run the following command in PHP (on Ubuntu): <?php if (exec("/home/johnboy/ffmpeg/ffmpeg -i test1.mp4 -acodec aac -ab 128kb -vcodec mpeg4 -b 1220kb -mbd 1 -s 320x180 final_video.mov")) { echo "Success"; } else { echo "No good"; } And I always get "No good" echoed back, and no file created. ...
Hi. I haven't found a very good answer to my problem so I'm starting a new topic. I have the file english.php which has variables like $lang['fname'] = "First name";. Also I have header.php which includes english.php : include('english.php');. Now, header.php is included in another php page, let say addInfo.php. If I write in addInfo.php...
I have to parse a javascript date string to a timestamp. If the date string has the TZ info, why do I have to supply a TZ object in the DateTime constructor and again with setTimezone()? Is there an easier way to do this that is aware of the TZ info in the date? $s = 'Thu Mar 11 2010 13:00:00 GMT-0500 (EST)'; $dt_obj = new DateTime($s, ...
Is it possible to use strtolower in the substitution part of preg_replace? This isn’t working: preg_replace('/(http:\/\/)?(www\.)?([a-zA-Z0-9\-_\.]+\.(com|co\.uk|org|tv|biz)(\/[a-zA-Z0-9\-\._\?&=#\+;]+)*)/i', '<a href="http://www.'.strtolower('$3').'" target="_blank">'.strtolower('$3').'</a>', $d); ...
Hi, I am trying to load a series of cities/countries in a textbox to display using jquery autocomplete. To do this, I attach the autocomplete to the textbox and call a PHP routine called SEARCH.php. This works fine if SEARCH is on the same server. When I try to call search from a different server (in this case, an ASP server), I get a ...
Hello, Anonymous functions are available from PHP 5.3. Should I use them or avoid them? If so, how? Thank you Edited; just found some nice trick with php anonymous functions... $container = new DependencyInjectionContainer(); $container->mail = function($container) {}; $conteiner->db = function($container) {}; $co...
Assuming I have a Config class that I use to access the config vars from everywhere (Config::X). Is it possible to implement a function that can be called from outside the class that adds and/or modifies properties? Something like this is what I'm thinking of: class Config { const myVar = 'blah'; public static function write( ...
I have an ApacheFriends XAMPP running on my windows machine and i am trying to access some Paradox database files directly from PHP. I see that there is an extension for this but how can i install it for my windows system ? Mike ...
Is there an easy way to convert date and time like this: Sun, 14 Mar 2010 09:00:00 GMT To this format: 20100306T153626 in PHP ...
In PHP, I know that using parameterized queries is the best way to prevent SQL injection. But what about sanitizing user input that will be used for other purposes, such as: Displaying back to a user (potential cross-site scripting vector) Addressing an email or filling in the message body Is htmlentities() the best way to sanitize ...
Hi, I'm preparing a query for mySQL to grab record from the previous week, but I have to treat weeks as Monday - Sunday. I had originally done this: WHERE YEARWEEK(contactDate) = YEARWEEK(DATE_SUB(CURDATE(),INTERVAL 7 DAY)) to discover that mySQL treats weeks as Sunday - Monday. So instead I'm parsing getting the begin & end dates in...
I'm trying to create clean URLs and so far I've managed to use .htaccess to convert the following URL: www.example.com/index.php?catagory=Section1&page=Page1 into: www.example.com/Section1/Page1/ The problem is then getting PHP to interpret the URL and extract the variables. Here's the code I'm using: .htaccess code: Options +Follo...
Im using Debian testing, i have installed php-cli and when i try to execute a php script it output the source instead of executing it. Example: php test.php <? phpinfo(); ?> any ideas how to fix this behavior, i tried reinstalling and purging no results. ...
I want that cms\framework to create me tables like "Users" "Cameras" and so on and declare classes and simple default methods for them (like paged sql relults and so on). I mean I say to it: I want Users to have ID, SpecialNumber and Name Flilds. and I want to get from it class for table generation (to call it once) and class containing...
i work with php/Mysql i have table with two cols (date , cash) with values like {7/2001:100$, 12/2001:50$ , 1/2002:30$ , 5/2002:90$ , 6/2003:80$,9/2003:20$ } i would like to make cash flow table that have cols (Jan,Feb,Mar,............Dec) and row for every year in the date array and the value of cash in the table cells like blow . Ho...