php

Get Template Name - Smarty

I'm dealing with website is a mess and need to find out the template file that smarty is rendering. Is there a method on the smarty template object that I can call to get the current template file? for example echo $tplObj->getTemplate(); // echos "shop/templates/cart.tpl" ...

Drupal: Customize blog post "submission" area?

I created my own node-blog.tpl.php - I'm looking to modify this code: <?php if ( $submitted ):?> <span class="submitted"><?php echo $submitted;?></span> <?php endif; ?> I need to re-arrange the structure of the contents of the $submitted variable. ...

How to rearrange the following data using php?

i retrieved the following data using sql query from mysql TOTAL COMPUTER DATE GROUP ----------------------------------------------- 48 LAPTOP2 2009-08-19 1 77 LAPTOP2 2009-08-20 1 0 LAPTOP2 2009-08-21 1 15 LAPTOP1 2009-08-19 1 25 MAIN 2009-08-...

What's the default javascript library used in symfony 1.4?

I'm reading a tutorial for 1.2,which says prototype is the built in library : http://www.symfony-project.org/book/1_2/11-Ajax-Integration What about the newest version of symfony? I'm only familiar with jQuery,is there an easy way to replace the default by jQuery? ...

unexpected T_RETURN, expecting T_FUNCTION when installing apc

I am trying to install apc with command yum install apc it's giving me following error Parse error: syntax error, unexpected T_RETURN, expecting T_FUNCTION in /usr/local/lib/php/Archive/Tar.php on line 251 what could be the reason ? ...

Http Digest Authentication, Handle different browser char-sets...

Hi all, I tried to use the Http Authentication Digest Scheme with my php (apache module) based website. In general it works fine, but when it comes to verification of the username / hash against my user database i run into a problem. Of course i do not want to store the user´s password in my database, so i tend to store the A1 hashvalue ...

mod_rewrite causes apache to crash with Rewritemap prg directive

Apache configuration: RewriteEngine on RewriteLock /var/www/lib/rewrite.lock RewriteMap sessionValid prg:/var/www/lib/allow.php I fixed the obvious of setting the file executable, but now it is giving this: [Fri Feb 12 01:55:31 2010] [error] (2)No such file or directory: exec of '/var/www/lib/allow.php' failed But the file clearly...

Is there a reliable way to know whether a request is in an Ajax context in PHP?

I need to deal with these two cases differently,is there a good solution? ...

High latency in an iPhone mmorpg

Right now I'm trying to make a mmorpg for the iPhone. I have it set up so that the iPhone requests for the player positions several times a second. How it does this is that the client sends a request using asynchronous NSURLConnection to a php page that loads the positions from a mysql database and returns it in json. However, it takes a...

php date time function

hi , I want to convert this date ( 02-12-2010) mm-dd-yyyy to time format ie to 02-12-2010 0 hours 0 minutes and 0 seconds i have user time and date functions but when i refresh the page its value is changing as per the time. i need that to be fixed also i want to convert this date (01-24-2009) to time format. please help me Tha...

ftp_put() [<a href='function.ftp-put'>function.ftp-put</a>]: Ok to send data.

I wrote a FTP app that uploads files to a remote server with PHP FTP's functionality. However I constantly get the following error ftp_put() [<a href='function.ftp-put'>function.ftp-put</a>]: Ok to send data. and have no idea what this means. This is how the line looks where I'm getting the error ftp_put($connection, $main_dir.'/class.p...

How to use regular expressions to extract the term inbetween the square brackets in PHP?

I have something like: $string1="dog fox [cat]" I need the contents inside [ ] i.e cat another question: if you are familiar with regex in one language, will it do for the other languages as well? ...

PHP based game - giving each user own database

Is it possible to have a webbased PHP/mySQL game, where each user has his own database with data about his/her account. It's a singleplayer management game where each user will need to have their own database. Or atleast, that's the way I see this. Is this the right solution, and will this work in terms of server bandwidth and such. Y...

How do I match accented characters in preg_match()?

I've read how accented characters might sometimes match [a-z]. What I'd like to know is how I could match a specific accented character. Obviously, preg_match('/[ñ]/', 'ñ') does not work. ...

Using simpleDom.php to parse an xml file works fine in windows but failsin unix .

Using simpleDom.php to parse an xml file works fine in windows but failsin unix . <br /> <b>Fatal error</b>: Uncaught exception 'InvalidArgumentException' with message 'chunk is not well balanced ' in SimpleDOM.php:576 Stack trace: #0 lib.php(367): SimpleDOM-&gt;insertXML('&lt;prebuilt.credi...') #1 save_document....

i have a html form. And i want my output to be in excel sheet. Please suggest want i have to do. PHP.

i have a html form. And i want my output to be in excel sheet. Please suggest want i have to do. PHP. ...

Cake PHP Link Doesn't Display

I have string like "Venditoris: Beware of Scams » Blog Archive » Trilegiant Complaints ..." in Database but when I try to display it ,It is not displaying. So,I used html_entity_decode function but still it is not display. I am Using cakePHP.below is my code to display that links. echo $html->link(html_entity_decode( $listing_end_a...

Rewriting php in Grails - Totally stuck!!!

Hi, I have to re-write a few php pages in in Grails (don't ask why!). I have never done any php, so it's proving a little tricky. Basically I have a html page which has a function in it that is executed every 60 seconds, and that .js creates a new XMLHttpRequest which then does xmlHttp.open("GET", "myphpfile.php", true); I can get...

Drupal: Create a unique selector for admin styles?

I'd like to style some components differently in the admin. How could I generate a unique id/class on the body element so I could style admin elements separately? ...

Choosing a thumbnail from an external link

I am trying to build a script that retrieves a list of thumbnail images from an external link, much like Facebook does when you share a link and can choose the thumbnail image that is associated with that post. My script currently works like this: file_get_contents on the URL preg_match_all to match any <img src="" in the contents Wor...