php5

scandir outside web tree using PHP5

I'm looking for a way to get directory listing for files that are outside the webserver's tree, for example i want to list all files and folders under '/home' directory and put them in an array (just as scandir does). I can 'sudo su' to a user that has rights to check the directory content but i don't know how to convert a directory lis...

copy node attributes to parent node

Im working with PHP5, and I need to transform XML in the following form: <section> <heading> <line absolutePage="4" page="2" num="35">A Heading</line> </heading> <subsection type="type1"> <heading label="3"> <line absolutePage="4" page="2" num="36">A Subheading</line> ...

What is the difference between const and static vars?

If I have a class and want to have some static vars, which would be the correct way to declare them? For example class Foo{     public static $var1     public static $var2     public static $var3     ...... } OR class Foo{     const $var1     const $var2     const $var3     ...... } both ways let me use Foo::var1...

Can Use JQ Insted of PHP for Webdevelopment.

can we use JQ insted of php for developing website. which one is more preferable. I think we can also use JQ for web development.Using JQ we can Execute MySql query like php. Which One is better? and why? ...

How to Shut Down CodeIgniter Application?

Assume I have a CI app that does the following: Allow users to log in and perform certain tasks Constantly have cron running scripts in the background Now, say I need to do some upgrades to the site. How do I do this safely? I don’t want to shut down the server while users are logged in or cron script still running. I could set a fl...

how to get dynamic URL like mydomain.com/username using zend framework

Hello guys I am developing an application using zend framework. In the application I have to provide a URL for each user like mydomain.com/[username] then public will be able to view his profile. [username] is the username of the particular user But how can I achieve this ? I think in ZF mydomain.com/username tries to get the controll...

zend headtitle using zend_navigation

I am using zend_navigation for creating menu. Which works fine. Now i m looking if i can take current page and set it as page title using headTitle. Is there is any way to do that? or how can i use config files (.ini) for creating Pagetitle and meta data ? ...

How to create an RSS feed?

One of my clients gave me the following link as a reference for how it is possible to implement same thing in our site. So please help - give me important links that will help me implement this: http://www.expertclick.com/RssFeed.aspx?type=releases ...

How to apply different style to Wordpress wp_nav_menu()

Hi, I am using Wordpress 3.0.Is it possible to apply different style class to wordpress wp_nav_menu()? Currently five pages for me and I would like to apply in following order. <ul> <h2> <li><a href="#">Example1</a> </li> </h2> <span> <li><a href="#">Example2</a></li> </span> <h4> <li>...

Selecting PHP Combo Box and Button

Hi There! I am currently using PHP 5 with a MysSQL database with 2 tables. So far my PHP Combo Box is working however I need to access the values selected from the combo box. it goes like this: 1) I select a value from the Combo Box. 2) I click on the Submit button 3) The Submit button brings me to another webpage. The problem that my ...

How to build Acronyms of a phrase in PHP

Hi I'm looking for a way that I can extract the first letter of each word from an input field and place it into a variable. Example: if the input field is "Stack-Overflow Questions Tags Users" then the output for the variable should be something like "SOQTU" Any help is appreciated. Thanks ...

What others see as URL when we work with localhost changed in the hosts file?

Hello, Let me introduce to the situation we had to face it and the core of the question. We needed in our project to change the "localhost" to be something else like "newdomain-localhost.com", so we changed the hosts file (in Windows) and everything worked. We reached the wall of Facebook with its sharer, where you need to get the sit...

sending mail using pear

I have installed pear and when sending mail, I get the following error: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 6144 bytes) in C:\wamp\www\GamesRus\mail.php on line 2 I am running on windows 7. Here is my code: $mail = Mail::factory("mail"); $headers = array("From"=>"[email protected]", "Subject"=...

What is the PHP equivalent of the VBScript CStr function?

I have the following VBScript code, which I'm converting to PHP: result = MyLibrary.InitSLibLibrary(cstr(LicsKey)) ScannerErrorAlert result Can anyone tell me the PHP equivalent of the CStr function used in this code? ...

Apache Alias or ScriptAlias in use with PHP doesn't work

I'm trying to set an Alias in Apache to use for PHP files where all my PHP scripts reside. Usually, we write: Alias /php-bin/ "/var/www/php-bin/" Unfortunately this doesn't work for PHP: <?php require /php-bin/file.php; ?> Apache still understands the Alias (I made some tests), PHP however doesn't find the Alias the way it's suppos...

loop for these iterations

I am trying to loop the below iteration, the code is below and i will try and break it down aswell. <?php function intr($LoanRequired, $TermMonths, $MonthlyPayment, $rate) { $intr= $LoanRequired * pow((1 + $rate), $TermMonths) + $MonthlyPayment * ((pow((1 + $rate), $TermMonths) - 1) / $rate); return $intr; } $x0=0...

url rewriting in windows server

I have upload my site on windows server, but when i use .htacess in my site then it is not working. means no page will open it show page not found error. but it is working properly in localhost.I want to know whether windows server support .htaccess(Url rewriting) or not. if it support then how can i enable it on server. thank you ...

Magento Onepage Checkout missing a step

Hi, we've got an almost-finished-ready-to-go magento shop, that has developed an annoying problem. On the one page checkout, one of the steps has gone missing! The "shipping" tab, despite being present in the array of values inside the Mage_Checkout_Block_Onepage->getSteps() method, doesn't display. We've tried everything to figure out...

PHP open source shopping inventory application

Hi , Please refer some good shopping inventory application(stock in-stock out application) open source. Thanks ...

Best way to get last element of an array w/o deleting it?

Ok, I know all about array_pop(), but that deletes the last element. What's the best way to get the last element of an array without deleting it? EDIT: Here's a bonus: $array = array('a' => 'a', 'b' => 'b', 'c' => 'c'); or even $array = array('a', 'b', 'c', 'd'); unset($array[2]); echo $array[sizeof($array) - 1]; // Output: PHP No...