Consider the code below:
<?php
class Base {
protected $name = "Base";
public function getName() {
return $this->name;
}
}
class Foo extends Base {
protected $name = "Foo";
}
$f = new Foo();
echo $f->getName(); // output: Foo
$b = new Base();
echo $b->getName(); // output: Base
Since in ...
Basically, I am trying to recreate PHP date's year functionality. Using the number of seconds since 1 January 1970, I am trying to get the year with out using a built in function. I had a an idea, but it did not work because of leap years. Can anyone give me a working formula that takes the seconds since 1970 and gets a year from it?
...
Hi, Please tell me the pattern to validate a twitter handler using preg_match
Thanks
...
I have a picture uplaod tool which reloads the page (which contains a form) whenever a picture is chosen.
I have this code to "remember" the drop list options selected, so basically I am creating options using php:
$posted_type=$row['9_type']; //From mysql db
$types = array('Clothes', 'Bags', 'Others');
$category_table .= "<select nam...
Hi Guys, I have been asked to parse a simple file which is stored as an XML file, the data is to be then save it to a mysql.
However I have absolutely no clue what to do and after looking online all the examples given seem either too complicated for my problem or not the right solution. The XML file looks like this
games_scores.xml
<g...
Hi, I've set up my config.xml and my controller, my data model class and resource class and I can see that the classes are loading and can echo out the object and NULL data object information.
However, when I try to call the ->load method of the data model object, I get the whitescreen of death. I've double checked and triple checked m...
Hello!
How can I use is_file with a path like: /folder/file.jpg please?
Thank you!
...
I just installed mysql-5.1.51-osx10.6-x86_64 and I'm having issues. Also installed MySQL.prefPane and MySQLStartupItem.pkg. Lastly I added MySQL to $PATH
$echo $PATH
$/usr/local/mysql/bin
now when if I:
$ sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
$ Password:
$ mysql
$ERROR 2002 (HY000): Can't connect to local MySQL serv...
This is a test engine application with 5 papers set by me..as 5 php pages
Flow of the application
Login.html
check.php // to check whether credentials r right
if correct then
main.php //user clicks on "take test" in this page which displays him 1 of the 5 papers...
but once i am logged in i can just change the url to the url o...
Hi,
I have written a small php script which uses clean urls for which mod_rewrite rules are used. that script needs to know where is located in order to run.
root domain : yourdomain.com
sub dir yourdomain.com/subdir/
Currently to set path for the script. I use following two,
Case: root domain:
define("ScriptURl",'http://'.$_SE...
Im looking for a way to select the innermost div with PHP
for example:
<div>
<div>
<div>
-
</div>
</div>
<div>
<div>
<div>
-
</div>
</div>
</div>
</div>
The DIV's containing the - would be selected in the NodeList
Im using DOMDocument...
Hey guys,
I have a lot of php code and I'm going through it right now (500+ files). I was hoping to find a program that would let me easily search through the files to see which files contain a specific variable I am editing. Kind of like a super edit -> find from notepad++. Anyone have any suggestions?
Best,
Pavan
...
Hi ,
I am having many websites . In that I have to send some parameters from php to flash. All the parameters are getting correctly displayed in flash except the currency symbol. These currency symbols are extracted from db to php in form of html entities like(& pound;). I can't change the db as it will require many changes in all websit...
Is there way how to get breadcrumbs for specific page by it´s id?
My attempt follows but i get only page label. No breadcrumb path.
$view = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->view;
$page = $view->navigation ()->findBy ('id', 'menuCategory29');
// work fine page label is displayed
echo $page->getTitle(...
I'm planning on storing the number of times an article / page has been viewed in a database. This is so that I can have a list of "most popular posts / articles" in Wordpress.
This was a good thread for similar question: http://stackoverflow.com/questions/943967/how-view-count-is-best-implemented
My question is: A person may view an ar...
This is a noob PHP writing to system question. Are there restrictions to php's copy() function writing within a password protected directory?
I'm trying to write the generated html content from a template page. I'm getting:
"401 Unauthorized
The requested page requires authentication"
File permissions for the template file, destinati...
Out of curiosity. I've been thinking about the different access models often seen in *nix and the one seen in windows nt based systems.
Is there any command or api to check if a file is readable, executable etc for a user different than the logged in user. For instance something like:
http://www.php.net/manual/en/function.is-executable...
I want to be able to either Press the enter key or click the mouse to submit the info in the inputbox.
Right now when you manually change focus using tab or click with mouse it will submit the info. It is using the jQuery live Click method.
I found this solution for setting focus to a button
http://stackoverflow.com/questions/3839342/...
I want to use the if statement to select specific pages that have <body class="section-category"> and output custom content for only those pages.
My PHP is not very good and I hope this is a very simple task to do. Can anyone give me a tip?
...
Hi, I can't understand why this PHP script gives me 500 internal server error.
$query = "SELECT video_id,title FROM video_id";
$videos = mysql_query($query);
if($videos){
$videos = mysql_fetch_assoc($videos);
foreach($videos as $video){
echo '<div class="video">';
echo '<a href="video.php?v="'.$video['vid...