[MoD]template-system

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [MoD]template-system

    ok, it is not really a mod, it is just a snipped. but it is extremly powerful :D.
    it activates the templatesystem. as you know u can choose different theme styles/theme/xxx as themes.
    this mod let you add custom templates.
    as ususal this can be viewed at tests 2moons . go to settings -> change skin and see that the templates are different :)
    we now do a tutorial

    first
    make a folder

    styles/templates/new/game/
    then also
    styles/theme/new/

    copy the stuff form folder gow to folder new (copy means in both folder you have the same stuff)

    now go to
    styles/templates/new/game/ and add

    page.officier.default.tpl.txt


    now comes the snipped :)
    edit includes/classes/class.template.php
    find

    PHP Source Code

    1. global $LNG;
    2. $this->compile_id = $LNG->getLanguage();
    replace width

    PHP Source Code

    1. global $LNG, $THEME;
    2. $this->compile_id = $LNG->getLanguage() . $THEME->skininfo["tag"];
    3. if(in_array(substr (strrchr ($file, "|"), 1) , $THEME->customtpls) && MODE === 'INGAME'){
    4. $this->setTemplateDir('styles/templates/' . $THEME->skininfo["tag"] . '/game/');
    5. }



    now you go to styles/theme/new/style.cfg

    PHP Source Code

    1. <?php
    2. $Skin = array(
    3. 'name' => 'new skin',
    4. 'tag' => 'new', #this will be also the foldername for the templates
    5. 'author' => 'icke',
    6. 'templates' => array('page.officier.default.tpl'), #example array('page.officier.default.tpl' , 'page.buildings.default.tpl' , 'page.research.default.tpl') If Skin have CustomTemplates, copy them to styles/templates/<theme tag>/ and add the names here
    7. );
    now you shoud have a skin, can be choosen with settings -> skin -> new

    wich has a custom officerpage.

    ps:don't forget to delete the .txt at the end of page.officer.default.tpl.txt
  • pss:if it ever goes so far, the spyreports declare their compile_id for the cache of templates in
    includes\classes\missions\MissionCaseSpy.class.php line 141 there you would have to add the theme tag. :D
    but i guess for most of the people it does not matter :)
  • Hey, that's working well. Could you show me how to do the same, but with the login page?
    I completly can't understand how layout editing works in this script - simple replacing of image does not work.
  • your tpl nav...you have your topnav css ..etc....if you use chrome press f12 study the system also via the tpl files....viewing the source from chrome and making temp changes is great to make unaffected changes.....and you learn a lot that way also
  • this is a templatesystem, it is not the templates themselfs. this mod is for people who are able to write a second or more skins/ templates.
    so it is not a skin/template. it is an example how to use different templates for the same sites.

    ops. have seen now, what you mean. changed the format.css files for some experiments^^ and didn't moved it back.
  • kleiner add.
    wenn ihr in der includes/pages/abstractgamepage.php

    in der function display

    $this->tplObj->display('extends:layout.'.$this->getWindow().'.tpl|'.$file);
    zu
    $this->tplObj->display('extends:styles/templates/' . $THEME->skininfo["tag"] . '/game/layout.'.$this->getWindow().'.tpl|'.$file);
    ändert, könnt ihr auch den pfad der layout tpls bestimmen.

    werd mal versuchen die änderung aus der class.template.php mit in die abstractpage zu ziehen. glaub das wäre sauberer. (nur die compile_id muss trotzdem verändert werden, glaub ich)

    ps:die files müssen natürlich in den entsprechenden ordnern hinterlegt werden. (und ein extraorner für gow müsste auch her :(.)
    also geht, aber is noch etwas unkomfortable. werds noch verbessern.