php

How to build url in smarty template?

In template I have two strings which I want to combine in one. {assign var="bigUrl" value="Search?searchFor=Member&{$searchUrl}"} To be able to use variable {$bigUrl} below in template, like this: <a href={$bigUrl}>Link</a> When I write mentioned assignment smarty compiler report error: syntax error: invalid attribute name: '=' ...

Have a variable available for class __construct()

I am trying to pass a variable into a class so the __construct() can use it however the __construct() is called before any variables are passed to the class. Is there any way to send the variable before the __construct()? Here is the code: class Controller { public $variable; function __construct() { echo $this->variable; } } $ap...

Get text between complex tags in PHP

Hi, I'm trying to get text from in between 2 html tags, only the difficulty is that the tag can differ from name. I'll explain into detail: <icon displayid="62115">inv_helmet_130</icon> I have to get the inv_helmet_130 But the displayid of the tag can differ, any ideas on how to solve this? Perhaps with a regular explression b...

Codeigniter diffrent DB for each language

hey, I'm using codeigniter and the project i'm working on has to be in two languages. The only thing i can't figure out is how to select a different database in codeigniter when a session variable is set to a certain value. example: if the session variable 'language' is set to 'EN' i want it to select the DB: "databasename_EN" in al...

How do you make good use of multicore CPUs in your PHP/MySQL applications?

Hi, I maintain a custom built CMS-like application. Whenever a document is submitted, several tasks are performed that can be roughly grouped into the following categories: MySQL queries. HTML content parsing. Search index updating. Category 1 includes updates to various MySQL tables relating to a document's content. Category 2 inc...

MySQL equivalent of PHP's base_convert?

Hello, Does anyone know of an equivalent function in MySQL of PHP's base_convert? http://php.net/manual/en/function.base-convert.php Thanks, Mark ...

Category as a Horizontal menu in wordpress

Hai, I have some parent catogories and sub categories in wordpress. I would like to have parent catogory as a main horizontal menu and sub menu as a sub category of that specific parent catogory. Both main menu and submenu should be in the horizontal structure. So on mouse over of the main menu will show the submenu. could u guys help m...

PHP what is the best approach to split these values up?

Hi all, Having a hard time with this one as I don't think I know all of my options. I have to parse a free form text field that I need to map the values to a database. Here is some example text, NOTE: not all fields have to be there, not all delimiters are the same and not all descriptors are available. I do need to check if the value ...

Redirect *.php to clean URL

My htaccess doesn't quite work: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)\.php$ /blah/$1 [R=301,L] RewriteRule ^(.*)$ /blah/index.php/$1 [L] Basically /blah/about.php should redirect to /blah/about I'm using codeigniter so the last line is required to process URL's. Th...

Do browsers support autocomplete for ajax loaded login forms at all?

My problem is, that the browsers' (IE&FF) autocomplete does not work for my login form. I have a webapp with CakePHP & jQuery. To allow visitors to login/register unobtrusively. The login form is inside a div, which is loaded via AJAX. (This enables logging in without a page reload.) The browsers do recognize it as a login field, as th...

read more link in post is not working wordpress

Hi, How to bring the read more link at the end of the post in the home page of my blog? Basically in my home page, it display all the content of the post, i would like to limit the characters to display thanks ...

print data as pdf using php

Hi Friends, i have a website in that user needs to take report as pdf[in code] , i tried the following code , nut it displayes some special characters , Please help me to fix this issue. <?php require('fpdf.php'); //create a FPDF object $pdf=new FPDF(); //set document properties $pdf->SetAuthor('Lana Kovacevic'); $pdf->SetTitle('FP...

Compiling a PHP extention library on Ubuntu (Karmic Koala)

I compiled some PHP extention libs (in C/C++) a while back, on my XP platform. I have now moved the sources to my Ubuntu box, and want to build the libs for use on my Linux box. However, I have come accross a number of obstacles: I cant locate phpize (even after installing the php5dev package) I cant find ext_skel to generate the skel...

Tag Conventions

Currently, these are the preparations I'm making: Convert to lowercase. Strip HTML tags. Check if tag already exists Are there any other things that I consider? note: Tags may be in Arabic. here the method i use function sanitize_tag($tag){ //strip slashes if(get_magic_quotes_gpc()) { $tag = stripslashes(trim($tag)); } //Re...

reading mail from PHP

i am searching for a way to read mail messages from a PHP application, including access to attachments etc. imap functions are not acceptable as a solution, as this application will handle mails with heavy attachments. i have full access to the server's mail folder from php via filesystem. any thoughts? ...

Delete the line contains specific words/phrases with PHP

guys i have a text file and i want to remove some lines that contain specific words <?php // set source file name and path $source = "problem.txt"; // read raw text as array $raw = file($source) or die("Cannot read file"); now there's array from which i want to remove some lines and want to use them so on example words, martin , m...

How do I define a default value for an array in php to avoid undefined offset?

I am using this code using isset to check if empty: if(!isset($this->objCodes[0]->SignupCode))$this->objCodes[0]->"NULL"; But it doesn't work. Help? ...

Paypal to return true or false

Hey, So I am curious on how to setup a recurring payment like I have here, but I need paypal to return to me if the payment was successful, and ONCE it is go to X.PHP page where I update the MySQL User Table stating he has setup payment. If anyone could give me some guidance that would be great. echo '<form action="https://www.pay...

Google Docs API. Upload file using curl.

Hi. Anyone know how to post file using curl to the google documents. I write this code: $header[] = "Authorization: GoogleLogin auth=seсretkey"; $header[] = "Content-Type: application/pdf"; $header[] = "Slug: testdoc"; $header[] = "Content-Length: ".$_FILES['file']['size'].""; $url = "http://docs.google.com/feeds/documents/private/full"...

Apache SetEnv appends REDIRECT_ . What gives?

For an application based on Zend Framework I use apaches SetEnv in .htaccess. I use this on test, staging and production servers like so: SetEnv APPLICATION_ENVIRONMENT production On the staging server I couldn't read this env var in PHP. However when I did a var_dump( $_ENV ) in php I got the value but the key was prepended with REDI...