HTML

Utolsó kommentek

  • cipo000: Jó kis szösszenet, jó zenével :) Amúgy a felvonulásokkal, csak annyi a probléma, hogy a kitűzött c... (2011.07.21. 02:08) Nem a nem a nem, hanem a nem
  • 0k-: annyit talán számít, h egy idő után nem lehet majd normálisan vitatkozni a dolgokról, de legalábbi... (2011.03.12. 09:50) Vicc
  • 0k-: és a politikusok ezt a szófacsart nagyon szeretik csinálni, én gusztustalannak tartom. megszorítás... (2011.03.12. 09:37) Vicc
  • 0k-: na, örülök srácok! eddig egyik posztomra sem jött ennyi komment. persze nem meglepő, h izgalmasabb... (2011.03.12. 09:28) Vicc
  • fraki: @mavo: "nem." Akkor buzizz egyet a parlamentben, és nézd meg, mi történik :) De egyébként... "a... (2011.03.12. 08:35) Vicc
  • Utolsó 20

Címkék

3d (1) 56 (1) adatbázis (3) ajánló (22) aleksandar zograf (1) amorf ördögök (1) animáció (11) arc (3) árt (29) bada dada (1) barbár (3) bertrand russell (1) bienálé (1) bigyó (3) bipod (1) biztonság (2) blu (1) britney spears (1) cakephp (2) chip (1) cigi (1) címke (5) colourlovers (1) daily monster (1) development (6) dmh (1) don hertzfeldt (1) downloadr (1) edith piaf (1) én (2) english (3) feladvány (1) film (7) flash (4) fotó (12) game (1) games (1) gil scott heron (1) google (1) hálózat (1) halu falu (1) henri barbusse (1) hiba.cc (1) hiphop (3) hírdetés (2) hoodwink.d (1) hunglish (1) idézet (6) információ (4) játék (7) játékok (1) john cage (1) kabala (1) kaparós (1) kép (12) képregény (6) kísérlet (4) klip (8) koincidencia (2) koncert (2) könyv (5) közhely (10) kulcstartó (1) lét (51) linkfelhő (1) linux (1) lol (10) lookalike (8) március 15 (1) marinaomi (1) martin jondo (1) matek (1) máv (1) mc hammer (1) mém (2) metanet (1) mix (5) mkkp (1) mobil (3) mp3 (5) n (1) nem (1) ninja (2) nyeremény (1) október 23 (1) one self (1) online (1) onyx (1) oscar (2) pajor tamás (1) php (1) plakát (3) plusminus design (1) pol (8) polaroid (1) pua (1) reggae (2) régi (3) retorika (2) scott mccloud (1) semmi (1) sickratman (1) sketchup (1) slate (1) smallcarrot (1) sol (1) space invaders (2) stencil atya (1) szem (5) szín (2) színház (2) télapó (1) ubuntu (1) ünnep (6) valentin (1) vers (8) verseny (2) vicc (1) video (30) web20 (2) webkamera (1) weblapszemle (3) wifi (1) windows network (1) wondercon 2007 (1) zene (28) zuboly (1)

Ezt olvasom

Custom starting year for date-time selection tags in CakePHP

2007.02.01. 12:51 0k-

CakePHP has builtin functions in it's HTML Helper class to easily generate dropdown lists for date selection: dayOptionTag(), monthOptionTag(), yearOptionTag() and finally dateTimeOptionTag(). The latter is very handy for quickly constructing registration pages. By default the starting year for this tag is 1947 (in version 1.1.11.4064) that you cannot directly change, however by modifying the third parameter of yearOptionTag() - which dateTimeOptionTag() relies on - you can change this default behaviour. Alas you have to make changes in the framework, namely in the HTMl Helper class to do this. The source at issue is:
[...]/cake/libs/view/helpers/html.phpLook for the function dateTimeOptionTag(), and specifically this piece of code:
switch($dateFormat) {
    case 'DMY': // so uses the new selex
        $opt = $this->dayOptionTag($tagName, null, $day, $selectDayAttr, $optionAttr, $showEmpty) . '-' .
        $this->monthOptionTag($tagName, null, $month, $selectMonthAttr, $optionAttr, $showEmpty) . '-' . $this->yearOptionTag($tagName, null, null, null, $year, $selectYearAttr, $optionAttr, $showEmpty);
    break;
    case 'MDY':
        $opt = $this->monthOptionTag($tagName, null, $month, $selectMonthAttr, $optionAttr, $showEmpty) . '-' .
        $this->dayOptionTag($tagName, null, $day, $selectDayAttr, $optionAttr, $showEmpty) . '-' . $this->yearOptionTag($tagName, null, null, null, $year, $selectYearAttr, $optionAttr, $showEmpty);
    break;
    case 'YMD':
        $opt = $this->yearOptionTag($tagName, null, null, null, $year, $selectYearAttr, $optionAttr, $showEmpty) . '-' .
        $this->monthOptionTag($tagName, null, $month, $selectMonthAttr, $optionAttr, $showEmpty) . '-' .
        $this->dayOptionTag($tagName, null, $day, $selectDayAttr, $optionAttr, $showEmpty);
    break;
    case 'Y':
        $opt = $this->yearOptionTag($tagName, null, null, null, $selected, $selectYearAttr, $optionAttr, $showEmpty);
    break;
    case 'NONE':
    default:
        $opt = '';
    break;
}

In the above code you can change the starting year by replacing the third parameters of yearOptionTag() calls with a number you wish (instead of leaving it being null). This is easy, but implicates a bigger problem. Since you need to modify the framework itself, you cannot store CakePHP in and include from a single folder, but you have to copy the changed source to your actual project folder (and every project folder that need custom starting year). Something must be done about this in future versions of CakePHP. Otherwise it is a nifty framework to work with.

Szólj hozzá!

Címkék: php english cakephp development

A bejegyzés trackback címe:

https://szellemszar.blog.hu/api/trackback/id/tr7432731

Trackbackek, pingbackek:

Pingback: BLOG » Blog Archive » Modifying dateTimeOptionTag() in CakePHP 2007.07.26. 16:04:02

[...]see if anyone else has written something about it. Jackpot! Some dude has written how to modify the dateTimeOptionTag(). In[...]

Kommentek:

A hozzászólások a vonatkozó jogszabályok  értelmében felhasználói tartalomnak minősülnek, értük a szolgáltatás technikai  üzemeltetője semmilyen felelősséget nem vállal, azokat nem ellenőrzi. Kifogás esetén forduljon a blog szerkesztőjéhez. Részletek a  Felhasználási feltételekben és az adatvédelmi tájékoztatóban.

Nincsenek hozzászólások.
süti beállítások módosítása