Lo­ca­tion of files

OpenSource For You - - LET'S TRY DEVELOPERS -

ex­plained. It is im­per­a­tive to re­mem­ber that du­pli­cate ta­ble QDPHs DFURss GDWDEDsHs DGGHG WR WhH FRQ­fiJXUDWLRQ ZRXOG UDLsH D warn­ing be­cause the two ta­bles would get du­pli­cate class names dur­ing Code­gen. Typ­i­cally, Code­gen will raise an er­ror when sXFh LssXHs DULsH. 7R FRXQWHU WhLs, sHW SUH­fix DQG/RU sXI­fix YDOXHs for classNames in code­gen_set­tings.xml for the data­base whose 250 FODss fiOHs yRX ZRXOG ZDQW WR FDUUy WhH SUH­fix/sXI­fix. 7hH ORFDWLRQ RI fiOHs JHQHUDWHG GXULQJ WhH CRGHJHQ SURFHss GHSHQGs RQ WhH WySH RI fiOH. HHUH Ls D OLsW RI ORFDWLRQs ZhHUH WhH CRGHJHQHG fiOHs DUH sWRUHG: 1. in­cludes/meta_­con­trols/gen­er­ated/: 7hH fiOHs LQ WhLs di­rec­tory con­tain the ac­tual code for Me­taCon­trols and Data­Grids (in Me­taCon­trol-Gen and DataGrid-Gen classes) and are over­writ­ten each time Code­gen runs. They should not be used to store any cus­tom logic for the gen­er­ated Me­taCon­trols and Data­Grids. in­cludes/meta_­con­trols/: This di­rec­tory will con­tain the FODss fiOHs ZhHUH yRX FDQ ZULWH yRXU FXsWRP ORJLF IRU WhH Me­taCon­trols and Data­Grids be­cause they are cre­ated once and are not over­writ­ten on sub­se­quent code gen­er­a­tions. Th­ese are di­rectly de­rived from the Me­taCon­trolGen classes. in­cludes/model/gen­er­ated/: CRQWDLQs 250-GHQ FODss fiOHs for each ta­ble with the func­tions we dis­cussed ear­lier. They are over­writ­ten on sub­se­quent code gen­er­a­tions and th­ese too can­not hold any cus­tom code you write in them. in­cludes/model/: CRQWDLQs WhH 250 FODss fiOHs WhDW yRX should use while de­sign­ing your ap­pli­ca­tion. They are not over­writ­ten and are one great place to store your cus­tom meth­ods for each ta­ble sep­a­rately! in­cludes/form­base_­class­es_­gen­er­ated/: Con­tains the ab­stract classes to de­rive from, for cre­at­ing pages to list and edit en­tries in ta­bles, up­dated on each Code­gen run. drafts/pan­els/: Con­tains Code­gened pan­els that can be di­rectly used for cre­at­ing, edit­ing and delet­ing en­tries in ta­bles. They use Me­taCon­trols for the re­spec­tive ta­bles and add the ‘Save’, ‘Can­cel’ and ‘Delete’ but­tons for CRUD func­tion­al­ity. Th­ese pan­els are re­us­able in your ap­pli­ca­tion, and are recre­ated on each Code­gen. drafts/: Con­tains in­di­vid­ual pages for CRUD func­tion­al­ity for ta­bles. They are over­writ­ten each time Code­gen runs. In ad­di­tion to the files cre­ated to work upon ta­bles, the QCubed Code­gen sys­tem also up­dates three spe­cial files lo­cated in in­cludes/model/gen­er­ated. The files are: _class_ paths.inc.php, _type­_­class_­paths.inc.php and QQN.class.php. Th­ese files are vi­tal to the au­toload­ing fea­ture in QCubed, and must not be tam­pered with.

5.

6.

7. 'R QRW HYHU DOWHU DQy fiOHs ZhLFh DUH RYHU-ZULWWHQ RQ Code­gen. You would only lose your work. UsH 250 FODss fiOHs WR ZULWH DQy FRGH WhDW ZRUNs RQ WDEOH data di­rectly. This will fa­cil­i­tate or­gan­i­sa­tion of code, and UHGXFH WhH QXPEHU RI FXsWRP fiOHs yRX QHHG WR FUHDWH; H.J., LI you want to cre­ate a method that loads ob­jects us­ing a nonLQGHxHG FROXPQ, WhH 250 FODss Ls ZhHUH yRX shRXOG GH­fiQH LW. Choose drafts pages and the AJAX panel over ph­pPgAd­min (or ph­pMyAd­min) for in­putting data—they are safer and come with val­i­da­tion logic. If you want to show a con­trol on your Web page, which di­rectly re­lates to a ta­ble in the DB, try to use Me­taCon­trols rather than cre­at­ing a new con­trol, time and again. You can al­ter the looks and be­hav­iour of in­put con­trols you get via Me­taCon­trols. If you al­ter the col­umns (e.g., al­ter the length of var­char fiHOGs), Code­gen will up­date the con­straints on the Me­taCon­trols, mak­ing sure you do not have to rewrite the logic. Feel free to copy the Me­taCon­trols, Pan­els, Con­trols and Pages gen­er­ated by Code­gen and cre­ate your own classes by mod­i­fy­ing them—they are there to help you, not to re­strict you. How­ever, do check for changes in schema since your FXsWRP fiOHs DUH QRW DXWRPDWLFDOOy XSGDWHG. ,I yRX sLPSOy want to ‘add’ a func­tion­al­ity, it is bet­ter to cre­ate a new class in­her­it­ing from the gen­er­ated class (much the same way ORM classes are in­her­ited from ORM-Gen classes). Di­rec­tory lo­ca­tions are also con­trolled us­ing vari­ables GH­fiQHG LQ CRQ­figXUDWLRQ.LQC.ShS. If you want to change their lo­ca­tion, you can. Though QCubed gives you the free­dom to write your cus­tom queries, do it when QQuery does not sat­isfy your needs per­fectly. Try to stick to the gen­er­ated classes wher­ever you can—it saves labour. Data­Grids should be used to cre­ate sim­ple ta­bles with ba­sic search func­tion­al­ity. Data­Grids are not SEO friendly—they never pro­vide a hy­per­link to the sec­ond (and sub­se­quent) page re­sults; in­stead, work us­ing ac­tions and events. Use your own pag­i­na­tion if you re­quire SEO. Your draft pages can be used to change data. Set ALLOW_ 5(027(BA'0,1 WR ‘)DOsH’ LQ WhH FRQ­fiJXUDWLRQ fiOH WR PDNH sure that ac­cess to them is re­stricted. All the above are sug­ges­tions, not rules. If you have a rea­son to, you can vi­o­late them (e.g., when you want to ac­cess the draft pages on your web­site from a re­mote com­puter, you should set ALLOW_ REMOTE_ADMIN to your pub­lic IP ad­dress). Use Code­gen as an aid and it will re­duce about 70 per cent of your work­load straight away—you must have al­ready re­alised how!

Newspapers in English

Newspapers from India

© PressReader. All rights reserved.