php

How to organize a PHP blog

So, currently I'm organizing my blog based on filename: To create a post I enter the name of the file. As opposed to storing the post in the database, I store them in PHP files. So each time I create a post, A new row in the table is created with the filename and a unique ID. To reference the post (e.g. for comments) I get the name of th...

Does Codeigniter work well with jQuery?

I've been using ASP.NET for a while but decided it's time to learn a PHP framework. Looking at an article NetTuts+ It looks like CodeIgniter is the simplest, and one of the lightest and easiest ways to go. I am however, a huge jQuery fan, and am wanting to know if jQuery integrates well with the framework? Any experience? ...

CMS built on Zend Framework

Is there a CMS built on Zend Framework? As alternative, are there classes that allow to easier implement a CMS with Zend Framework? If there are any CMSs, can you suggest which one is better, or which one you would use? ...

Need help finding a PHP e-Commerce package for virtual products/courses

Okay, I'm trying to figure out a good e-Commerce package for a client of mine, and it just isn't easy to find. I'm working on a LAMP system, so please try to restrict your software packages to that platform. (PHP 5 & MySQL 5 are easily available.) Don't mention Magento, that was a nightmare to attempt to install and maintain. I need ...

python import fails when called from PHP

I'm having a puzzling problem when trying to import a module in python only when the script is called from php via system or exec. From the python shell: import igraph #This works. if the previous line was in a file, say, test_module.py, then: python test_module.py in the bash works. Within PHP: exec("python test_module.py",$output,...

Help me with the Clean URL problem

I have an .htaccess file set up like so: RewriteEngine on RewriteRule ^home/ /member.php [L] So when users type http://domainname.com/home/ it goes to the member page, but when they type http://domainname.com/home I get a 404 error. What am I doing wrong? ...

Is it totally reckless to leave mysql connection open through a page?

When querying the db is it plausible to feel extremely paranoid? I go as far as opening and closing mysql connection every time a new query has to be done. I am afraid that (especially with the ajax enabled pages) this would cause great performance downgrading. Should I continue in this method or at least open and close connections once...

Software for quickest establishment of an online presence

So, every so often you get sites like http://www.twitmaps.com - sites created quickly and pushed online for a random purpose. Often either you have plenty of spare time, or you just don't have the opportunity to get your own ideas online. For example in this one, the snow images are very vague and could do with more accuracy. What too...

Symfony Method to Turn Template to String

I use the Symfony PHP MVC framework. I'm using JSON to pass an AJAX response, and I need an action's template HTML to be one of the values passed. Does Symfony have a method along the lines of renderTemplateToString() ? Even for those unfamiliar with Symfony, is there an obvious way to do this? ...

mysql where condition question

hi is that possible to use WHERE like this; $no = $_GET['no']; $query = "SELECT * FROM `numbers` WHERE `myno` - $no = 4"; ... if not, how can i get the rows like the below example ? EDIT: to be more clear, $today = date("Y-m-d"); $query = "SELECT * FROM `dates` WHERE date - $today = 7"; i want to find rows that has date field ...

PHP, HTTP_REFERER not working on iframe??

Okay, here is my situation. I have a page, index.php, which is the mainsite (flash site) I have another page called iframe.php which contain iframe of index.php Another page, test.php. Inside have 2 links, 1st link is directly to index.php, another link is to iframe.php I tested: I click the 1st link, when i trace/echo the HTTP_REF...

Elegant coding, how to deal with hidden/invisible HTML code ?

I am developing an ask-and-answer website. There is a "Choose as best answer" button besides each answer, this button should be visible to the asker but should be invisible to other viewers. Other part of the web page is almost the same. So how can I code this web page? Should I check the viewer identity every time to determine whether o...

CakePHP admin panel

I am new to CakePHP and want an admin panel on my custom CMS for a client. Is there any way other than just linking to an admin page to each controller that I can pull views from other controllers such as users and posts? ...

How to calculate sales tax with this script?

I'm using a shopping cart script from a tutorial I came across a while ago, and I need to modify it to calculate sales tax for my state (Pennsylvania). I want it to extract the state, compare it to either Pennsylvania or PA incase someone writes the state shorthand and then multiply the subtotal (for the items.. before shipping is added...

PHP - preg_replace with multiple matches

Let's say I have a string like: $text = "<object>item_id1a2b3</object>xxx<object>item_id4c5d6</object>" I want to convert it to: %ITEM:1a2b3xxx%ITEM:4c5d6 Here's what I've got: $text = preg_replace("/<object.*item_id([a-zA-Z0-9]+).*<\/object/","%ITEM:$1",$text); This isn't quite right, as the search is greedy. Thoughts? Than...

is it possible to ignore a fatal error in PHP?

I understand the significance of the term 'fatal error', but I want to write a test class like this (disgustingly simplified): class tester { function execute() { if( @$this->tryit() === true ) return true; return false; } function tryit() { $doesntexist = new noobject(); return true; } } act...

How to iterate, by month, between two specified dates

I have a website that was launched a few months ago. I would like to write some code that will look through every month, since launch, and grab metrics for that month. My question is: What is the best way to specify a start date, and then iterate by month, all the way up until the current month (or to another specified date). Does any...

Widely accepted methods for documenting PHP source code in an auto-doc way?

I'm new to PHP, and my current job requires me to pick up the language at an extremely quick pace. I'm a documentation stickler. I even like to write documentation. I'm familiar with accepted documentation syntax and tools for a handful of languages. This is not the case for PHP. I know there are always multiple methods for writing do...

how to make a user restrict to download?

I know this question is silly. But as per our intelligent Client request, I am not able to answer his question. Any one help for this. We are building a online tutoring site. where it contains pdf, .ppt, .doc formats files are uploaded for reading as course materials. His (Client) request is that user can read all the contents but they...

How to format datetime most easily in PHP?

To change 2009-12-09 13:32:15 to 09/12/2009 ...