Bealach iarratais ar sitemap.xml le rialtóir saincheaptha / gníomh

De réir Watkin Lloyd Steven , Dé Céadaoin 6 Eanáir, 2010 00:13

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 .

4 freagairtí ar "Bealach iarrataí ar sitemap.xml le rialtóir saincheaptha / gníomh"

  1. 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"

  2. [...] 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 /

  3. Walter a deir:

    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"

Leave a Reply













Lánléargas Téama Themocracy

4 cuairteoirí ar líne anois
3 aíonna, 1 bots, 0 baill
Tá 24 ag 12:36 UTC: Max cuairteoirí an lae inniu
An mhí seo: 26 ag 2011/07/05 12:35 UTC
I mbliana: 130 ag 28-03-2011 22:40 UTC
Gach uair: 130 ag 28-03-2011 22:40 UTC