Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. That's because you use relative paths like images/my-image.png which leads to the absolute path http://www.domain.com/item_details/language_en/currency_USD/images/my-image.png You can solve this by using either <base> or writing absolute paths instead of relative: function get_image($image_filename) { return HTTP_BASE_PATH . $image_filename; } use as: <img src="<?php get_image('images/my-image.png'); ?>" ...
  2. if(is_array($color_exploded)) { is obsolete as explode only returns something different then an array when: echo "<option value='" . $color_val . "' selected>" . $color . "</option>"; //add some ' I would replace that with: echo '<option value="',$color_val,'"',(($color_val === $chosen_color)?' selected="selected"':''),'>',$color,'</option>';
  3. function str_and(array $array) { $last_value = array_pop($array); return implode(', ', $array) . ' and ' . $last_value; }
  4. This secret knowledge sangoku is referring to is the query: UPDATE products SET quantity = quantity + 5 WHERE sn = 1 Depending on your sort of input there may be better methods
  5. 1. Invest in a proffesional looking website 2. Invest in making your website usable and accessible and valid!! 3. Read up on SEO, SEM, SEA, .. make sure to fully understand SEO Handy SEO document freely distributed by Google http://static.googleusercontent.com/external_content/untrusted_dlcp/www.google.com/nl//webmasters/docs/search-engine-optimization-starter-guide.pdf Learn to use the tools made available by popular search engines (webmaster, analytics, ..) Use Google Analytics to setup Goals and Funnels to see your website progress 4. Learn about writing good copy to lead to a call-to-action These are a few good starters
  6. How do you wish to test your website? If you want to test how many requests your server can currently process then you might be interested in Apache Bench http://httpd.apache.org/docs/2.0/programs/ab.html If you are interested in testing if all appropriate elements are in place you might be interested in Selenium http://seleniumhq.org/ So in what particular testing are you interested?
  7. A quick Google search turned up: http://www.devshed.com/c/a/PHP/Invoice-Management-in-a-PHP-Invoicing-System/3/
  8. Before going any further, what are your exact plans? Changes are there are better options available.
  9. Instead of creating your own rendering engine download webkit which is used by many popular web-browsers and build your browser around it. But why go through all this effort? http://webkit.org/
  10. If they can see your headers as-is that means your e-mail format is invalid which is why they can see your HTML as-is to. If you wrote FileMaker yourself I highly encourage to use a tested version like Zend_Mail which applies e-mail format according to the appropriate RFC
  11. 1. Should I put this code in my constructor method? No. 2. Should I set $dbh = null; at the end of the script or leave it open? This application will be hammering this class with queries non-stop, it's the crux of the website, looking up products in a catalog. Db connections are automatically closed at the end of the script so you can't leave it open not even with the persistent option. Plus you should be using something like: class Db extends PDO implements Db_Interface This decouples PDO from your models as the same could have been written: class Db extends MySQLi implements Db_Interface While your models only expect: class MyModel { public function __construct(Db_Interface $db) { Altough the above method (class Db extends ..) is not encouraged and an approach with a factory method and adapter pattern is encouraged Also always remember to lazy-load: interface Db_Interface { public function connect(); public function query($sql); } class MyDb extends PDO implements Db_Interface { public function query($sql) { $this->connect(); //.. } } A connection is made only when it is absolutly needed.
  12. 1. No doubt it will become HTML 5 that's called progress 2. Flash is dead, Apple killed it! Bastards! Only if you are just starting out with HTML programming otherwise you should use HTML 4. IE 8 for example does not support XHTML as it renders it as HTML Many mistake to write XHTML while declaring Content-Type: text/html which should be according to W3C application/xhtml+xml. If you use PHP you should set the default_mimetype directive to application/xhtml+xml as it overwrites your HTML declared Content-Type
  13. I think many countries do (formal) for example in Belgium you write the lastname followed by their firstname
  14. That ain't to hard just use HTTP_HOST
  15. http://www.builditwith.me/browse/ideas/
  16. No need for all this extra math keep it simple: function my_abs($value) { $value = intval($value); return $value < 0 ? 0 : $value; }
  17. To do that you first need to disable any and all decorators on the form elements: public function init() { $this->setDisableLoadDefaultDecorators(true); } Then for each element add the appropriate decorators like shown here: http://framework.zend.com/manual/en/zend.form.quickstart.html
  18. SELECT * FROM articles WHERE theme_id = 10 AND name = 'John' AND deleted = 'No' AND find_in_set(9, second_theme) is not null
  19. To expand on this, let's say my name is Joe Bobbleman. If a company wants to address me informally in an email they could be like "Hey Joe look what we have for you!", but of they wanted to be formal "Dear Mr. Bobbleman,"Of course emails aren't the only place this can happen, you can use your imagination Actually they would be able to do that in both cases ofcourse in the case of fullname you would need to add some more function calls to your query and you never know if they user gave a lastname in the first place but possible never the less
  20. Hi assume I have a database table structure like: And an interface like: interface GTM_Group_Interface { public function getId(); public function setId($id); public function getOwner(); public function setOwner(GTM_Subscriber_Interface $subscriber); public function getShortName(); public function setShortName($shortName); public function getLongName(); public function setLongName($longName); public function getSubscribers(); public function setSubscribers($subscribers); public function addSubscribers($subscribers); } Is this correct? Or am I doing it wrong?
  21. Are you on shared hosting? If so then you need to change the session save path using session_save_path you would get 50 minutes because the lowest value wins on a shared hosting. Edit: nevermind you already did that
  22. class MyForm extends Zend_Form { const ELEMENT_DAY = 'day'; const ELEMENT_MONTH = 'month'; const ELEMENT_YEAR = 'year'; public function getDay() { return $this->getValue(self::ELEMENT_DAY); } public function getMonth() { return $this->getValue(self::ELEMENT_MONTH); } public function getYear() { return $this->getValue(self::ELEMENT_YEAR); } public function isValid($data) { $isValid = true; $day = $this->getDay(); $month = $this->getMonth(); $year = $this->getYear(); if (!checkdate($day, $month, $year)) { $isValid = false; $this->getElement(self::ELEMENT_DAY)->addError('Invalid date specified'); } return parent::isValid($data) && $isValid; } public function init() { $e = $this->createElement('Select', self::ELEMENT_DAY); $e->setMultiOptions(range(1, 31)); $this->addElement($e); $e = $this->createElement('Select', self::ELEMENT_MONTH); $e->setMultiOptions(array_combine(range(1, 12), range('January', 'December'))); $this->addElement($e); $e = $this->createElement('Select', self::ELEMENT_YEAR); $e->setMultiOptions(range(idate('Y') - 100, idate('Y'))); $this->addElement($e); } }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.