php

Repetetive data in WordPress posts

Hey! I am creating a tutorial site for music producers. On each tutorial (post, that is) there will be some information that are repetitive and recurring, so I was wondering what's the best practice to enter this data while creating a post to later being able to present it in the post? This is an example, where the data is bold and lab...

Magento adding install object

I'm creating a module that let's you define some extra options for categorys in Magento, following this tuturial to get started: http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/installing_custom_attributes_with_your_module I built on a skeleton module created with ModuleCreator. I have ...

Which option is more scalable?

I'm working on php, mysql on a project I'm planning to add a multilanguage option, usually I use single textfile for each php file, but I want to know if one of the followings is good or not and why. Using one single textfile for the whole site: This would make my life peacefully because I have to make changes in one place only, but I...

Friendly url rewriting with php & .htaccess. Difficulties with relative links to css images & js

Hi there, I've currently an url like that : play.php?place=idplace&event=idevent I've enabled friendly url this way : RewriteEngine On RewriteRule ^([a-zA-Z0-9_-]+)$ play.php?place=$1 RewriteRule ^([a-zA-Z0-9_-]+)/$ /play.php?place=$1 RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ /play.php?place=$1&event=$2 RewriteRule ^([a-zA-Z0-9...

PHP Extract Line

I need to extract "C:\Documents and Settings" from the last line of this data: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft ExcludeSubDirs REG_DWORD 0x1 ExtensionList REG_SZ FirstAction REG_DWORD 0x11 ThreatName REG_SZ C:\Documents and Settings Owner REG_DWORD 0x3 ProtectionTechnolog REG_DWORD 0x1 Second...

Magento after Onepage checkout adding new products to cart

i would like to add some Products after the Checkout I have an observer and it's listening on 'checkout_onepage_controller_success_action' when i try $this->_getCart()->addProduct($product, $params); and save the cart the success page will be loaded but no new products in the cart. Any idea what's wrong? ...

Memory Issues with PHP (5)

Does calling unset() free the memory that was associated with that object? There are a couple cases where I find myself handling large associative arrays and I would like to remove them when done (freeing up memory to create new ones). ...

How to integrate site admin page with WordPress admin?

I am going to build a site that is mainly a word press blog, but the blog will have a link to a shop area where you can purchase products. I am going to have to build an admin page for the site owner to add/remove products. Since they are already going to be using the WordPress admin for their blog, I am wanting to integrate the produc...

How to insert element into array to specific position?

Hello, Let's imagine that we have two arrays $array_1 = array( '0' => 'zero', '1' => 'one', '2' => 'two', '3' => 'three', ); $array_2 = array( 'zero' => '0', 'one' => '1', 'two' => '2', 'three' => '3', ); Now, I'd like to insert array('sample_key' => 'sample_value') after third element of each array. How can I d...

Using PHP 5.3 namespaces (Doctrine2) with Zend Framework classes

i am having a situation where my doctrine model, Post, is in the namespace Application\Entities and i want to try to implement Zend_Acl_Resource_Interface. i get the error Fatal error: Interface 'Application\Entities\Zend_Acl_Resource_Interface' not found in D:\Projects\Websites\php\ZendFram ework\LearningZF\library\Applicat...

PHP: Using scandir(), folders are treated as files

Using PHP 5.3.3 (stable) on Linux CentOS 5.5. Here's my folder structure: www/myFolder/ www/myFolder/testFolder/ www/myFolder/testFile.txt Using scandir() against the "myFolder" folder I get the following results: . .. testFolder testFile.txt I'm trying to filter out the folders from the results and only return files: $scan = sca...

password sent via post secure?

Possible Duplicate: How secure is a HTTP POST? Suppose I have a login page in php where a user is required to enter his name and password. form method is post in this case. Now someone(my friend) told me that the information(username and password) that is entered and sent to the server can be hacked just by fetching the heade...

php file uploads' size

do we have any size issue with the file uploads that we perform in php using $_file[upload][name]? is there any restriction for the file upload using this ??? juz need to know .. ...

Change Content-type header in Kohana3

Hello. I'm trying to create a rss feed in my Kohana app. I did this in my controller: public function action_rss() { $games = ORM::factory('game') ->order_by('name','ASC') ->find_all() ->as_array(); $view = View::factory('home/rss') ->bind('games', $games); $this->request->$headers['Content...

Why is APC incrementing "Cache full count" for User Cache even though it has plenty of memory available?

I've played with this for quite a while but am at a bit of a loss as to what to do. I'm using APC 3.1.3p1 on CentOs 5 with PHP 5.2.5. APC is acting as both the opcode cache and user cache. Mostly this server runs Drupal 6 sites using the CacheRouter module for APC cache support. I was running APC 3.0.19 for a while but it was causing...

Language Switching in Magento

Hi, Thanks in advance, I am new to Magento and I need help switching languages for users. When a customer visits my website it should use their IP to determine their country and switch the language appropriately. For example, if I am visiting from France my site should display in French. If any others try from any country the website ...

how to disable aptana internal browser

hi i have myindex.php file and when i run it , it runs in the Internal web browser in aptana , while when I run blabla.html it runs through firefox , I just want the php file to run just like the html , and disable that annoying Internal browser. also would like to know what's the difference between (aptana) http://127.0.0.1:8000/blabl...

scope of objects stored in the registry-class php

I have a Registry where I store my request, validator, database and router objects. So for validation of my forms, I use a method in class MyForm, where the input fields are checked. When user input is incorrect, then Registry::getInstance()->validator->setErrors($errors) is called, so that errors are stored in the Registry and get avail...

Is there a way to override/rename/remap function in php?

I know it's possible in other language like C++ or Obj-c even (at runtime AND compile time) but is there a way to override/rename/remap function in php? So what I mean is, let's say we want to replace the implementation of mysql_query. Is that possible? SOME_REMAP_FUNCTION(mysql_query, new_mysql_query); //and then you define your new f...

a better approach than storing mysql password in plain text in config file?

It's always bothered me that many PHP programs require the user to store the mysql password in plain text (in a string or constant) in a configuration file in the application's root. Is there any better approach to this after all these years? So far I have come up with two minimal security boosts: make the file unreadable via the web...