ignace
Moderators-
Posts
6,457 -
Joined
-
Last visited
-
Days Won
26
Everything posted by ignace
-
A Class is a group of related state (variables) and behavior (functions).
-
Pretty much like you would share anything else: by passing it through the constructor or a setter-method. public function setDatabaseAdapter(Zend_Db_Adapter_Abstract $adapter)
-
Write a shopping cart? Personally I read books, a good one on PHP is Expert PHP and MySQL and after reading the book I always have a go with my new "toys".
-
You mean something like SOAP?
-
Yes, it's completely possible to normalize everything into multiple files. It won't be efficient but possible.
-
CakePHP is sloooowwwwwwwwwwwwwwwwww.
-
MrAdam was on the right track but you can add conditionals to XPath:
-
I meant that you replace: $handle = fopen("$url", "r"); $contents = ''; while (!feof($handle)) { $contents .= fread($handle, 8192); } fclose($handle); With $contents = file_get_contents($url);
-
$contents = file_get_contents($url);
-
YAGNI (You Ain't Gonna Need It) Bad idea. Just imagine someone hacks your account! Your application should suffice with one MySQL account with GRANTS on SELECT and INSERT. Not DELETE or UPDATE. You use a CMS for Content Management, if you DELETE it you can no longer manage it. Instead introduce archiving which is what businesses do once the data no longer serves any purpose to the company (but it may in the future) either on paper in some storage room or on digital format (CD, DVD, ..) or both. You also don't need UPDATE as CMS systems tend to version data. Look into version-control and check-in/out. CMS systems can become really complex depending on the business that needs them as almost each company has different business rules for content management. So while you are making your home-grown CMS system KEEP IT SHORT AND SIMPLE (KISS)
-
You should explain what you are trying to do, helping without context is difficult as I am sure the below won't give you the desired output also note that using aggregate functions implies GROUP BY SELECT table1.title, table1.status FROM table1, table2 WHERE table1.author = '{$username}' AND table2.deleted = 0 GROUP BY table2.id HAVING count(table2.id) > 0
-
What do you mean by make the link mobile?
-
$result = mysql_query('SELECT NickName FROM Profiles ORDER BY NickName'); $capital = ''; while(list($nickname) = mysql_fetch_row($result)) { if(0 == strcasecmp(substr($nickname, 0, 1), $capital)) { $capital = substr($nickname, 0, 1); echo strtoupper($capital), '<br>'; } echo $nickname, '<br>'; }
-
I believe that as a developer you should be aware of the inner workings of your favorite programming language. Someone who knows every function of PHP but can't tell you that the outcome for 'h' . 1 + 2 is 2 is not really that good as he'll miss most critical bugs. As for the framework versus built-in, there isn't much a difference IMO as both can be considered a framework. Just like you learned the framework by reading documentation you'll be able to read the documentation for built-in functionality (the latter mostly has a lower learning curve). (I do realize there is an exception to JavaScript due to incompatibility) So to answer your question, I do not believe that it is important for a developer to learn the core built-in functions prior to learning a framework this also makes a lot of sense IMO as most if not all developers Spam the PHP manual daily which indicates they aren't all that familiar with all the built-in functionality PHP has to offer.
-
We start with planning, creating a design that may work and try to make best guesses as what likely will change and in what way and try to accommodate our designs for those changes. For all this to work well you need a solid knowledge of OO principles and patterns although the latter is not really required but a welcome tool. Documentation. A term like Box is very vague and it's difficult to suggest designs without knowing the context. So either Andy-H's or Nightslyr's advice will do.
-
err...
-
echo isset($row_Best_Sellers['experience_description'][90]) // make sure there is something after the 80th character // cut the string off at the space preceding the 80th character ? substr($row_Best_Sellers['experience_description'], 0, strrpos($row_Best_Sellers['experience_description'], ' ', 80)) . '...' : $row_Best_Sellers['experience_description']; // otherwise just print it
-
What do you get as output? $string = substr($string,0,100); $string = substr($string,0,strrpos($string," ")); Should give you an output of less then 100 characters (unless the last character is a space of course). The below should give you the desired output. function some_function($string, $max_avg_length = 250) { return substr($string, 0, (isset($string[$max_avg_length]) ? strrpos($string, ' ', $max_avg_length) : 0)); }
-
SELECT $usrlang FROM autoreplies ORDER BY FIELD('0', '1', '2');
-
Try that and postback the output: $dir = new DirectoryIterator(dirname(__FILE__)); foreach ($dir as $fileinfo) { if (!$fileinfo->isDot()) { var_dump($fileinfo->getFilename()); } }
-
If we may believe that, we also may start believing in Microsoft pushing IE9 to all IE6 users.
-
Yup then my advice should do the trick.
-
Maybe take a PHP course?