Here's the situation:
I have a menu that needs to be created dynamically from the database.
The menu hierarchy is determined by a 'parent' column in the table (each entry has one parent or NULL if it is only a parent)
The problem is that I can't think of how I would dynamically do this, considering I need proper <ul><li><ul><li> structu...
I'm reading a flie with essentially upwards of ~500,000 lines separated out by | for the columns which I am parsing and trying to insert into the database through the CLI.. Is there a better way to read it in so I can use it?
Currently I'm inserting it as :
$fd = fopen ($txtFileName, "r");
while (!feof ($fd)) {
$buffer = f...
how to create an empty zip archve by php
some thing like
new -> zip archive
...
My nginx.conf file is getting larger and large with dozens of vhosts repeating the same lines over and over. I was wondering if there is anyway to declare the following globally without having to repeat them for each project:
# Route all requests for non-existent files to index.php
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php...
I am rendering the top-level elements of a Zend Navigation object in one place like this:
echo $this->navigation()->menu()->setMaxDepth(0);
How do I render the navigation tree from the second level on down for the active branch? I've tried creating a partial that loops the $this->container object, but I don't know how to determine if...
Hello,
How can I implement basic auth using php? Is it possible?
Thank you
...
Possible Duplicate:
What security issues should I look out for in PHP
How to protect my site(social networking) from being hacked?just suggest some methods that are in common?
i am using php for scripting & mysql for database and i am using CodeIgniter(php framework).
if you know some good tutorial or ebooks then provide me ...
I'm trying to check whether a $_POST exists and if it does, print it inside another string, if not, don't print at all.
something like this:
$fromPerson = '+from%3A'.$_POST['fromPerson'];
function fromPerson() {
if !($_POST['fromPerson']) {
print ''
} else {
print $fromPerson
};
}
$newString = fromPerson()...
eg.
let say it is the 326 day of the year.
you want to be able to get the month and the day of the month eg. Oct 23 etc.
what is the formula. how do i achieve this in php.
...
I have an array which i use to dynamically create a table.
I have a name=value pair (Server=server.alias) which values are being extracted and would like to make it hyperlinked to another webpage.
What I need help is figuring out the code to map the alias name with a specific href link which I think I will have to hard code. The href li...
Hello All,
As a test I am trying to create the simplest webpage where I can type a short post and have it simultaneously update my twitter account status and my facebook status. I also want to be able to read and display past statuses on this page as well. So basically I am trying to code the simplest example that can push and pull wi...
I have a text:
$test = <<<START
DOTHIS themsp1
@theint = 431,
@theText = "%dumdum%",
@operator = 'ANY',
@crossCheck = 'PLUS'
START;
The filter:
$regEx = '/@(.*)=(.*)[,]*?/';
preg_match_all($regEx,$test,$vars,PREG_SET_ORDER);
print_r($vars);
The Output:
Array
(
[0] => Array
(
[0] => @theint ...
Hi there,
Thank you for taking the time to read this and I will appreciate every single response no mater the quality of content. :)
I'm trying to create a php script which retries another php script up to 3 times until an error message is displayed. I'm thinking perhaps this could be done using a php loop? If the code works successful...
Possible Duplicate:
Random string that matches a regexp
Hi,
I have some regex's. Say I want to generate data in PHP that fit the individual regex.
Here is an example: ^[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,6}$ Found here for example.
Now, how can I programmatically generate data that fits that regex? I would like to generate...
I am using a custom post type in my wordpress theme, and I need help with the loop. Here is my code:
<?php $loop = new WP_Query( array( 'post_type' => 'magazine', 'posts_per_page' => 10 ) ); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<li>
<?php the_post_thumbnail( 'magazine' ); ?>
...
I have the following PHP that reads in a CSV file and outputs rows/cells of an HTML table. Can someone help me with an ASP.net equivalent?
<?php
$f = fopen("spreadsheet.csv", "r");
while (($line = fgetcsv($f)) !== false) {
if(trim($line) != '' && $line != "\n" && $line != "\r") {
echo '<tr>';
foreach ($line as $cell)...
Hi. I am using gettext to translate my site. In norwegian I need to use the charaters æøå, but they show up blank. I have set the $encoding = 'iso-8859-1';from wikipedia it says that æøå should be available, but as I said they show up blank. In poedit settings and my po/mo file I have set encoding to iso-8859-1.
ps. I want to support a...
When using Aptana with PHP 5.2.3 in debug mode (using thread safe XDebug 2.1.0 for PHP 5.2 VC6) to run a simple multi-line hello world script I get some erratic behaviour on the Aptana 'Console' tab.
I've a hello_world.php script that contains the following:
<?php
$stdout = fopen('php://stdout', 'w');
fwrite($stdout, 'Hello world!');
f...
When I include some PHP in my page to populate a load of HTML everything is preceeded with the characters . It's probably something daft but it's driving me nuts. I'm a newcomer to PHP so kid gloves please.
This is my include statement <?php $PSName="Solar Numbers"; $whereto="bot"; include("../php/menu.inc.php");?>
and this is the...
Hi, I am trying to integrate wordpress into a magento install but keep getting the following error when trying to include
Fatal error: Cannot redeclare __()
I assume this is because both magento and wordpress use this.
How can i get around this.
I have tried things like:
if(!function_exists('__()')) {
function __() {}
}
in b...