有三种布局模板的支持方式:
第一种方式:全局配置方式
这种方式仅需在项目配置文件中添加相关的布局模板配置,就可以简单实现模板布局功能,比较适用于全站使用相同布局的情况,需要配置开启LAYOUT_ON参数(默认不开启),并且设置布局入口文件名LAYOUT_NAME(默认为layout)。
‘LAYOUT_NAME’=>’layout’,
开启LAYOUT_ON后,我们的模板渲染流程就有所变化,例如:
Public function add() {
$this->display(‘add’);
}
}
在不开启LAYOUT_ON布局模板之前,会直接渲染Tpl/User/add.html模板文件,开启之后,首先会渲染Tpl/layout.html模板,布局模板的写法和其他模板的写法类似,本身也可以支持所有的模板标签以及包含文件,区别在于有一个特定的输出替换变量{__CONTENT__},例如,下面是一个典型的layout.html模板的写法:
{__CONTENT__}
<include file=”Public:footer” />
读取layout模板之后,会再解析User/add.html模板文件,并把解析后的内容替换到layout布局模板文件的{__CONTENT__}特定字符串。
当然可以通过设置来改变这个特定的替换字符串,例如:
但是一个布局模板同时只能有一个特定替换字符串。
采用这种布局方式的情况下,一旦User/add.html模板文件或者layout.html布局模板文件发生修改,都会导致模板重新编译。
如果需要指定其他位置的布局模板,可以使用:
就表示采用Tpl/Layout/layoutname.html作为布局模板。
如果某些页面不需要使用布局模板功能,可以在模板文件开头加上{__NOLAYOUT__}字符串。
如果上面的User/add.html模板文件里面包含有{__NOLAYOUT__},则即使当前开启布局模板,也不会进行布局模板解析。
第二种方式:模板标签方式
这种布局模板不需要在配置文件中设置任何参数,也不需要开启LAYOUT_ON,直接在模板文件中指定布局模板即可,相关的布局模板调整也在模板中进行。
以前面的输出模板为例,这种方式的入口还是在User/add.html模板,但是我们可以修改下add模板文件的内容,在头部增加下面的布局标签(记得首先关闭前面的LAYOUT_ON设置,否则可能出现布局循环):
表示当前模板文件需要使用layout.html布局模板文件,而布局模板文件的写法和上面第一种方式是一样的。当渲染User/add.html模板文件的时候,如果读取到layout标签,则会把当前模板的解析内容替换到layout布局模板的{__CONTENT__}特定字符串。
一个模板文件中只能使用一个布局模板,如果模板文件中没有使用任何layout标签则表示当前模板不使用任何布局。
如果需要使用其他的布局模板,可以改变layout的name属性,例如:
还可以在layout标签里面指定要替换的特定字符串:
由于所有include标签引入的文件都支持layout标签,所以,我们可以借助layout标签和include标签相结合的方式实现布局模板的嵌套。例如,上面的例子
<div id=”main” class=”main” >
{__CONTENT__}
</div>
<include file=”Public:footer” />
在引入的header和footer模板文件中也可以添加layout标签,例如header模板文件的开头添加如下标签:
这样就实现了在头部模板中引用了menu布局模板。
也可以采用两种布局方式的结合,可以实现更加复杂的模板布局以及嵌套功能。
第三种方式:使用layout控制模板布局
使用内置的layout方法可以更灵活的在程序中控制模板输出的布局功能,尤其适用于局部需要布局或者关闭布局的情况,这种方式也不需要在配置文件中开启LAYOUT_ON。例如:
Public function add() {
layout(true);
$this->display(‘add’);
}
}
表示当前的模板输出启用了布局模板,并且采用默认的layout布局模板。
如果当前输出需要使用不同的布局模板,可以动态的指定布局模板名称,例如:
Public function add() {
layout(‘Layout/newlayout’);
$this->display(‘add’);
}
}
或者使用layout方法动态关闭当前模板的布局功能(这种用法可以配合第一种布局方式,例如全局配置已经开启了布局,可以在某个页面单独关闭):
Public function add() {
layout(false); // 临时关闭当前模板的布局功能
$this->display(‘add’);
}
}
总结
三种模板布局方式中,第一种和第三种是在程序中配置实现模板布局,第二种方式则是单纯通过模板标签在模板中使用布局。具体选择什么方式,需要根据项目的实际情况来了。
波比源码 » ThinkPHP3.1快速入门(15)模板布局
levaquin sale buy levaquin 500mg generic
buy avodart 0.5mg generic dutasteride without prescription ondansetron 8mg us
spironolactone 25mg canada diflucan 100mg cost oral fluconazole 200mg
acillin generic buy acillin for sale erythromycin 250mg brand
order fildena 50mg sale buy methocarbamol 500mg pill purchase robaxin without prescription
sildenafil sale purchase sildenafil without prescription buy estradiol 2mg sale
lamictal generic buy lamotrigine generic retin cream cost
order tadalis 10mg without prescription buy tadalafil 10mg sale voltaren 50mg cheap
accutane 20mg us buy amoxicillin tablets azithromycin 500mg us
buy generic anastrozole 1mg purchase biaxin generic viagra pills 50mg
modafinil 200mg cost buy provigil 200mg generic diamox ca
buy doxycycline 100mg for sale buy levitra 20mg generic buy furosemide pill
order buspar generic ditropan 5mg over the counter oxybutynin generic
buy terazosin online hytrin 5mg over the counter azulfidine 500mg price
benicar pills depakote pills diamox 250 mg cheap
order prograf without prescription prograf 1mg pills ursodiol for sale
imdur sale imuran for sale telmisartan 80mg pills
buy salbutamol online cheap sildenafil for sale online brand viagra
order cialis 10mg generic Cialis in usa buy sildenafil 100mg without prescription
order cialis 5mg sale cialis 10mg canada generic amantadine 100mg
buy medroxyprogesterone online cheap generic provera 5mg order periactin pill
buy modafinil 100mg canada pharmacy ivermectin for people
fluvoxamine us order ketoconazole generic order glucotrol 10mg online cheap
accutane tablet purchase amoxil for sale buy generic prednisone 10mg
brand azithromycin order prednisolone 10mg generic gabapentin 600mg tablet
prices of cialis real viagra pharmacy prescription order viagra 50mg generic
cost itraconazole itraconazole 100mg without prescription order tinidazole 300mg for sale
metformin 500mg generic glucophage 500mg price cialis 40mg cheap
olanzapine 10mg generic diovan 80mg generic buy valsartan without prescription
brand linezolid 600mg casinos online online casino for real cash
order generic prilosec 10mg buy term papers online real money casino online
metoprolol 100mg ca buy tenormin 100mg online cheap order levitra 20mg sale
help writing research paper pay for paper writing buy viagra 100mg pills
order tadalafil 10mg pill buy sildenafil tablets sildenafil overnight shipping usa
aristocort medication aristocort price buy clarinex generic
dapoxetine 30mg uk generic synthroid 75mcg order generic levothyroxine
buy cialis for sale oral viagra sildenafil ca
order cialis 10mg pill buy plavix 150mg online buy plavix
buy domperidone 10mg generic cyclobenzaprine us buy cyclobenzaprine 15mg
losartan for sale nexium 40mg oral topamax 200mg oral
imitrex pills order avodart online cheap generic avodart
colchicine pills casino games online real money world tavern poker online
buy ranitidine 150mg generic order ranitidine pills buy celebrex 200mg generic
casino online gambling play roulette free for fun card games online
purchase flomax generic oral zofran 8mg buy aldactone 25mg
simvastatin ca purchase propecia without prescription finasteride online order
order diflucan pill buy viagra online sildenafil uk
tadalafil 20mg us cheap sildenafil sale buy viagra for sale
free casino slot games best casino online order cialis online
cheap desyrel 50mg buy desyrel 50mg generic aurogra 100mg for sale
thesis website pay for assignment stromectol covid
online slots real money stromectol ca provigil 200mg price
buy tretinoin generic tadalafil over the counter avana 200mg drug
buy tadacip sale order indomethacin generic order generic indomethacin 75mg
order terbinafine 250mg online oral lamisil order amoxicillin 250mg pills
naproxen 250mg brand order naproxen 500mg generic order prevacid
order proventil 100 mcg pills purchase albuterol pills ciprofloxacin 1000mg for sale
purchase singulair generic viagra 50mg over the counter viagra usa
tadalafil for sale online Buy discount cialis free casino slot games
Jouer au casino en ligne sur les sites agréés de jeux d’argent autorisés par la France En France, il vous est impossible d’accéder aux sites des casinos qui ne détiennent pas de licence. De plus, les joueurs français qui jouent sur une plateforme de jeu non homologuée et reconnue par les autorités locales peuvent s’exposer à des sanctions pénales. Enfin, en jouant sur un casino illégal, il va de soi que vous ne pourrez pas vous plaindre auprès des mêmes autorités en cas d’arnaque. Les casinos en ligne connaissent depuis des années une véritable popularité. Toutefois, les gouvernements ne voient pas cela d’un très bon œil. Les raisons de cette interdiction des jeux de hasard en ligne sont assez diverses et dépendent d’un État à l’autre. Alors que certains pays interdisent totalement les jeux d’argent, d’autres tentes d’imposer des réglementations afin de réguler au maximum ce genre de pratiques.
https://titussyqi321098.vidublog.com/16812118/site-de-poker-en-ligne-gratuit
Essayez-vous sur Big Bass Bonanza et tentez de gagner le jackpot sur ce slot à 5 rouleaux et 10 lignes de paiement. Avec cette machine à sous, vous avez la possibilité de décrocher des poissons-jackpot et de gagner jusqu’à x2100 votre mise initiale. Le jeu est relativement simple et fun. La stratégie ultime pour gagner aux machines à sous est évidemment liées aux mises. Comme dans tout jeu de casino, jouer rime souvent avec miser. Et à chaque jeu son types de mises. Quelles sont les types de mises et comment miser aux machines à sous? Nous avons consacré un article à cette question dont dépend beaucoup l’optimisation de votre jeu. Dans cet article nous vous parlerons taux de redistribution, choix de la machine à sous, choix des options de jeu, mais aussi lignes de gain …
buy nifedipine 30mg for sale purchase adalat without prescription purchase fexofenadine online
altace 10mg pill glimepiride 4mg canada order etoricoxib 120mg
Kerala Blasters will take on Goa on Sunday, November 13, at Jawaharlal Nehru International Stadium (Kochi, Kerala).If you are looking for KBFC vs FCG Dream11 Fantasy Football Prediction then you are at the right place. #6 Is there a playoff round in Indian Super League after the regular season?There isn’t a playoff competition after the regular season in Indian Super League. Doha: Spain put on a footballing masterclass … M01 | OCT 14, 2022 | Chennaiyin FC 1-1 Bengaluru FC, Match Report Simon Grayson’s side went into the new ISL season on the back of a first Durand Cup title. With fans once again allowed into the stadiums, expectations from the 2018-’19 champions were high. There was a new hope. However, the pre-season buzz has not translated into results on the pitch. There goes the final whistle and East Bengal draw a blank on the Kolkata Derby. ATKMB found the net twice within 10 minutes in the second half, and that is more than enough for them for a memorable night.
https://tiny-wiki.win/index.php?title=Mobile_flash_score_soccer_results
The UEFA word, the UEFA logo and all marks related to UEFA competitions, are protected by trademarks and/or copyright of UEFA. No use for commercial purposes may be made of such trademarks. Use of UEFA.com signifies your agreement to the Terms and Conditions and Privacy Policy. Email address not available. Always keeping abreast of the events in the football world is a task for true fans. With livescores.biz it becomes much easier, because all football today results are published on one site, which will allow you not to miss an interesting event. ©Tue Nov 29 22:44:10 CET 2022 xscores.com All rights reserved. The Women’s ITF World Tennis Tour offers approximately 500 tournaments in over 60 countries worldwide and incorporates five prize money levels of tournaments: 15s – offering $15,000 in prize money; 25s – offering $25,000 in prize money; 60s – offering $60,000 in prize money; 80s – offering $80,000 in prize money; 100s – offering $100,000 in prize money.
asacol cheap asacol 400mg canada buy avapro 150mg pills
buy acetazolamide 250 mg generic imuran ca buy azathioprine 25mg without prescription
order clobetasol generic purchase temovate online purchase amiodarone sale
buy coreg 25mg for sale order coreg 6.25mg generic purchase amitriptyline
amoxicillin 250mg price buy stromectol without prescription ivermectin buy online
generic nortriptyline paxil oral order paroxetine sale
UFC 284 Betting I’m between BetOnline and 5dimes based on feedback so far. BetOnline GUI looks nicer, but I don’t really care that much about it. Copyright © 2023 Penske Business Media. All rights reserved. Horse Racing Betting – Where To Bet on the Horses Of course, to top the list is one of the best sports betting sites and the official sportsbook of the UFC, the DraftKings Sportsbook. This deal (made in 2021) gives DraftKings exclusive rights to particular promotions for UFC events, boosted odds, in-broadcast odds for live betting, and UFC branding and marketing assets for the sports betting platform. DraftKings has been a household name in the US for daily fantasy sports since 2012 and eventually launched one of the country’s biggest sportsbooks betting apps in late 2018 after changes in legislation were made earlier that year.
https://subscribe.ru/author/30778294
Put it all together, and I’m excited to grab +100 odds at FanDuel. You can also find +100 odds at BetRivers, but DraftKings and Pointsbet have the over priced out to -110 and -115. Last updated: Feb 7, 2:56 PM UTC We got some NBA player props for you! Eight NBA games are on the program this evening, meaning that there are literally thousands of player props you can bet on. We’re here to help you choose the winning ones with our top three picks for tonight’s games. Clippers vs Nets How to Watch Odds Prop All odds via DraftKings Sportsbook Best NBA Bets Today | NBA Picks February 7 Analyzing Tuesday’s Cincinnati at Tulane odds and lines, with college basketball expert picks, predictions and best bets. Check out our best 76ers vs. Knicks picks based on the top NBA odds. My Pick: Suns at Pistons Over
doxycycline for sale online chloroquine tablet medrol 4mg oral
buy fenofibrate generic order viagra 50mg pills sildenafil ca
buy tadacip 20mg generic clopidogrel 75mg ca buy amoxicillin 250mg pills
buy provigil 100mg sale order promethazine promethazine 25mg cheap
purchase glycomet online cheap glucophage 500mg generic buy nolvadex 20mg online cheap
prednisone 20mg brand order accutane for sale buy amoxil 250mg generic
ivermectin 12mg stromectol order prednisone 10mg prednisone 10mg tablet
albuterol over the counter buy augmentin 375mg pill buy amoxiclav for sale
buy accutane 40mg sale generic azithromycin 500mg buy zithromax 250mg for sale