Bealach iarratais ar sitemap.xml le rialtóir saincheaptha / gníomh
D'fhonn iarratais dhíreacha / sitemap.xml le rialaitheoir saincheaptha agus gníomh i do Zend Creat a chur i bhfeidhm ach an méid seo a leanas i do application.ini nó malartacha comhad cumraíochta (eg úsáid mé navigation.ini):
resources.router.routes.sitemap.route = "sitemap.xml" resources.router.routes.sitemap.defaults.controller; innéacs resources.router.routes.sitemap.defaults.action; léarscáil an tSuímh
Is féidir Sampla cód le haghaidh outputting a bheith le feiceáil ag a chruthú i mbun gníomhaíochta i rialtóir iomchuí (eg mo léarscáil an tSuímh luíonn an rialtóir innéacs, léarscáil an tSuímh gníomh):
< php IndexController rang Síneann Zend_Controller_Action { / ** * Rindreáil ar léarscáil an tSuímh bunaithe ar Zend_Navigation thus * / sitemapAction feidhm phoiblí () { macalla $ seo nascleanúint-> amharc-> () -> léarscáil an tSuímh (); $ Seo a leagan amach-> amharc-> () -> disableLayout (); $ Seo-> setNoRender viewRenderer-> _helper-> (fíor); } }
Is féidir Sitemaps tapa agus go héasca a ghiniúint ag baint úsáide as Zend_Navigation , ar mór mear teagaisc (agus go ginearálta an-úsáideach le haghaidh ranganna teagaisc Zend Réime) Is é Casts Zend - dinimiciúil a chruthú roghchlár léarscáil an tSuímh agus breadcrumbs .


















































Rud amháin Forgot liom a lua go mbainfidh tú gá freisin a shonrú do bealach caighdeánach do do léarscáil an tSuímh, ar shlí go mbeidh gach URL pointe a / sitemap.xml má úsáideann tú Zend_Navigation_Page_Mvc (má tá tú ag soláthar URIs nach mbeidh ann a bheith ina fhadhb ).
Mar shampla, úsáideann mo tionscadal is déanaí routing méid seo a leanas:
; ==============================
; Acmhainní Routing
; ==============================
resources.router.routes.www.type = "Zend_Controller_Router_Route_Hostname"
resources.router.routes.www.route = ": module.example.com"
resources.router.routes.www.defaults.module = "default"
resources.router.routes.www.chains.index.type = "Zend_Controller_Router_Route"
resources.router.routes.www.chains.index.route = ": rialaitheoir /: gníomh / *"
resources.router.routes.www.chains.index.defaults.controller = "innéacs"
resources.router.routes.www.chains.index.defaults.action = "innéacs"
resources.router.routes.sitemap.type = "Zend_Controller_Router_Route"
resources.router.routes.sitemap.route = "sitemap.xml"
resources.router.routes.sitemap.defaults.controller; innéacs
resources.router.routes.sitemap.defaults.action; léarscáil an tSuímh
Dá bhrí sin, i mo navigation.xml (nó cibé cumraíochta shocraíonn tú a úsáid), beidh ort a shonrú ar an routing a úsáid, mar shampla,
default.pro.pages.aboutUs.label = "phróifíl na Cuideachta"
default.pro.pages.aboutUs.module = "www"
default.pro.pages.aboutUs.controller = "faoi-linn"
default.pro.pages.aboutUs.action = "innéacs"
default.pro.pages.aboutUs.resource = "www_pages"
default.pro.pages.aboutUs.route = "www-innéacs"
[...] Go leanfar ar mo phost seo caite faoi Zend_Navigation, iarrataí Bealach ar sitemap.xml le rialtóir saincheaptha / gníomhaíochta, is é an post seo faoi chur dymnamically leathanaigh le coimeádán Zend_Navigation ag [...] runtime script /
Tá mé fadhbanna tromchúiseacha, ní féidir liom é a réiteach: (
Tá mé router.ini
resources.router.routes.sitemap.type = "Zend_Controller_Router_Route"
resources.router.routes.sitemap.route = "sitemap.xml"
resources.router.routes.sitemap.defaults.controller; innéacs
resources.router.routes.sitemap.defaults.action; léarscáil an tSuímh
agus bootstrap.php
_initRouter feidhm chosanta ()
{
$ FrontController = Zend_Controller_Front:: getInstance ();
$ Cumraíochta = nua Zend_Config_Ini (APPLICATION_PATH '/ config / router.ini'.);
$ Ródaire = $ getRouter frontController-> ();
$ Ródaire-> addConfig ($ config, 'ródaire');
}
agus gheobhaidh mé earráid seo:
Eisceacht eolais:
Teachtaireacht: rialtóir neamhbhailí sonraithe (sitemap.xml)
Iarratas Paraiméadair:
eagar (
'Rialtóir' => 'sitemap.xml',
'Ghníomhaíocht' 'innéacs' =>,
'Modúl' => 'default',
)
Bheadh sé cosúil go bhfuil tú ag iarraidh cúpla iontrálacha, déan iarracht do thabhairt suas chun dáta bealaí a mheaitseáil:
resources.router.routes.sitemap.type = "Zend_Controller_Router_Route_Static"
resources.router.routes.sitemap.route = "sitemap.xml"
resources.router.routes.sitemap.controller = "innéacs"
resources.router.routes.sitemap.action = "léarscáil an tSuímh"
resources.router.routes.sitemap.defaults.module = "www"
resources.router.routes.sitemap.defaults.controller = "innéacs"
resources.router.routes.sitemap.defaults.action = "léarscáil an tSuímh"
resources.router.routes.sitemap.defaults.route = "www-innéacs"