Ergebnis 1 bis 9 von 9

Thema: von Template ändern

  1. #1
    Contao-Nutzer
    Registriert seit
    10.01.2013.
    Beiträge
    27
    Partner-ID
    9162

    Frage von Template ändern

    Hallo

    Was ist die beste Lösung in Conto 3.5.x, um die Template zu ändern?

    Ich bin in view : x.html5, formular is gesendet, ich will den view y.html5 anzeigen, was muss ich machen.

    Danke

  2. #2
    Alter Contao-Hase Avatar von Messa
    Registriert seit
    19.01.2011.
    Ort
    Vorarlberg, Österreich
    Beiträge
    1.423

    Standard

    Kannst du deine Frage besser stellen?
    Ich verstehe vorab nur Bahnhof

    Was möchtest du genau machen?
    Wenn du dich mit Deutsch schwer tust stell die Frage einfach in Englisch.

    lg Matthias
    Full Service Agentur - Grafikdesign, Screendesign, Webdesign, Webentwicklung, SEO, Weiterbildung, persönliches Coaching
    http://www.matthiasgmeiner.com

  3. #3
    Contao-Nutzer
    Registriert seit
    10.01.2013.
    Beiträge
    27
    Partner-ID
    9162

    Frage Thanks

    Sorry, let's do it in english.

    In "classes" I have a module that is calling the template "x.html5", when the user click a button (Form submit) on "x.html5" template I want to redirect him to "y.html5" what is the clean way to do this?

    should I alter the $strTemplate value?

  4. #4
    Contao-Urgestein Avatar von fiedsch
    Registriert seit
    09.07.2009.
    Ort
    München
    Beiträge
    2.948

    Standard

    maybe use the redirect() method?

    You do not redirect to a template. A template is used by a module to render it's output.

    Do you want to render the output using a different template (which would be $this->template = new FrontendTemplate(nameoftemplate)) or do you want to redirect to a different page?
    Contao-Community-Treff Bayern: http://www.contao-bayern.de

  5. #5
    Contao-Urgestein Avatar von do_while
    Registriert seit
    15.06.2009.
    Ort
    Berlin | Deutschland
    Beiträge
    3.615
    Partner-ID
    1081
    User beschenken
    Wunschliste
    Contao-Projekt unterstützen

    Support Contao

    Standard

    I don't understand 100% of your question, but this extension may help you:
    https://contao.org/de/erweiterungsli...ksplitter.html

    You can redirect depending on a value of form variable.

  6. #6
    Contao-Nutzer
    Registriert seit
    10.01.2013.
    Beiträge
    27
    Partner-ID
    9162

    Standard

    Zitat Zitat von fiedsch Beitrag anzeigen
    maybe use the redirect() method?

    You do not redirect to a template. A template is used by a module to render it's output.

    Do you want to render the output using a different template (which would be $this->template = new FrontendTemplate(nameoftemplate)) or do you want to redirect to a different page?

    Ok so my question is, I want to redirect to a new template (if possible staying on the same page URL).

    PHP-Code:
    Is there a difference between doing ? :
    $this->Template = new \FrontendTemplate($myTemplateName);
    or 
    $strTemplate $myTemplateName

    I'm trying this "$this->Template = new \FrontendTemplate($myTemplateName);" but I got a blank screen even if I re-generated the autoload.

  7. #7
    Contao-Nutzer
    Registriert seit
    07.12.2009.
    Beiträge
    151

    Standard

    Zitat Zitat von iteration.info Beitrag anzeigen
    Is there a difference between doing
    PHP-Code:
    $this->Template = new \FrontendTemplate($myTemplateName); //(1) 
    or
    PHP-Code:
    $strTemplate $myTemplateName// (2) 
    It depends on where you do what. If you do (1) in your compile method, you overwrite the templates object that was already instanciated in the Module class.

    If you do (2) in your modules generate function and call parent::generate() afterwards, you switch the template without overwriting the instance.

    I guess it may help if you read the code of the base class for every frontend module in module.php.


    Zitat Zitat von iteration.info Beitrag anzeigen
    I'm trying this "$this->Template = new \FrontendTemplate($myTemplateName);" but I got a blank screen even if I re-generated the autoload.
    What does $myTemplateName contain? Where is the desired template file stored? Please post your module code.

    Best

  8. #8
    Contao-Nutzer
    Registriert seit
    10.01.2013.
    Beiträge
    27
    Partner-ID
    9162

    Standard

    Thanks
    Geändert von iteration.info (21.09.2015 um 22:16 Uhr)

  9. #9
    Contao-Nutzer
    Registriert seit
    10.01.2013.
    Beiträge
    27
    Partner-ID
    9162

    Standard

    Hello

    Got it!

    Have to use : $this->strTemplate
    and not $strTemplate

    And it's working, thanks for your help guys!

Aktive Benutzer

Aktive Benutzer

Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)

Lesezeichen

Lesezeichen

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •