Jahia DX > Creating a template...

0 (0 Good)
0 (0 Bad)

Creating a template set (for dummies)

by  madsbuus »  2011/06/07 18:03

Hi Jahia-guys,

I would like to create a real template set for later production deployment. I have fooled around with the studio, duplicating existing template sets, and trying to create a site that use my own templates,
but the perfect setup eludes me.

I would like:

* A structured way of getting other developers started on using my template set (source control based)
* An easy way to update changes to the templates (without wiping everything)
* Instant reload of jsp, css, javascript (no wars,/maven please) when developing.

Is this possible?

The solution may need some symlinks to work, thats fine.

Found issues:
Duplicating template sets does not create a workable template set. The template set is registered with the same name as the origin, which causes strange problems...

I have tried taking a copy of an existing template set, replace all parts with my templates set name, but can not get it to show up in the studio drop-down, or the content manager or the 'select template set' when creating new sites (which might be the same thing).

The import.zip stuff with the repository.xml seems to be the jcr-stuff jahia needs to throws into the database, but even though the repository.xml is correct, it does not show up in there.

Regards,
Mads
  • Creating a template set (for dummies)
    2011/06/07 18:03

    madsbuus Hi Jahia-guys,<br/><br/>I would like to create a real template set for later production deployment. I have fooled around with the studio, duplicating existing template sets, and trying to create a site that use my own templates,<br/>but the perfect setup eludes me. <br/><br/>I would like:<br/><br/>* A structured way of getting other developers started on using my template set (source control based)<br/>* An easy way to update changes to the templates (without wiping everything) <br/>* Instant reload of jsp, css, javascript (no wars,/maven please) when developing.<br/><br/>Is this possible?<br/><br/>The solution may need some symlinks to work, thats fine.<br/><br/>Found issues:<br/>Duplicating template sets does not create a workable template set. The template set is registered with the same name as the origin, which causes strange problems...<br/><br/>I have tried taking a copy of an existing template set, replace all parts with my templates set name, but can not get it to show up in the studio drop-down, or the content manager or the 'select template set' when creating new sites (which might be the same thing).<br/><br/>The import.zip stuff with the repository.xml seems to be the jcr-stuff jahia needs to throws into the database, but even though the repository.xml is correct, it does not show up in there.<br/><br/>Regards,<br/>Mads

  • Number of messages  8
    Registration date Jun 7, 2011
    0 (0 Good)
    0 (0 Bad)

    Re: Creating a template set (for dummies)

    by  rvt »  2011/06/07 18:03

     

    MDA,

    i cannot answer all your questions but here we go...

    * Instant reload of jsp, css, javascript (no wars,/maven please) when developing.

    I have had good success by editing my template in that is 'deployed' in the modules directory. Adding JS/CSS and changes of templates work instant, just re-load the page that uses the template.

    One area I had less good suces/understanding with is how to manage themes. A theme seems to be packages within a import.zip file and I am not sure yet how I can manage this from Jahia, may be this is still under development...

    * A structured way of getting other developers started on using my template set (source control based)

    Not sure what's the best method since I am currently alone on this project. WHat I currently do for creating demo website on our server is that I go into Jahia and let Jahia create a war for distribution. 

    I guess that if you want to put the template under revision control you would have to your modules/templates-name into revision control, don't hold me on that though!!!

    * An easy way to update changes to the templates (without wiping everything) 

    I never had the need to do that since I just edit my template that's deployed under modules.

    I had always good luck creating a new template set in studio, changing 'stuff' inside a war never really worked for me and always ended up in some sort of a problem, specially with that zip file in the war.

    So, best is to create a new template set, not based on anything (for me at least).

    Hope that helps a bit..

  • Re: Creating a template set (for dummies)
    2011/06/30 15:51

    rvt <p> &nbsp;</p> <p> <title></title> </p> <p> MDA,</p> <p> i cannot answer all your questions but here we go...</p> <blockquote> <p> * Instant reload of jsp, css, javascript (no wars,/maven please) when developing.</p> </blockquote> <p> I have had good success by editing my template in that is &#39;deployed&#39; in the modules directory. Adding JS/CSS and changes of templates work instant, just re-load the page that uses the template.</p> <p> One area I had less good suces/understanding with is how to manage themes. A theme seems to be packages within a import.zip file and I am not sure yet how I can manage this from Jahia, may be this is still under development...</p> <blockquote> <p> * A structured way of getting other developers started on using my template set (source control based)</p> </blockquote> <p> Not sure what&#39;s the best method since I am currently alone on this project. WHat I currently do for creating demo website on our server is that I go into Jahia and let Jahia create a war for distribution.&nbsp;</p> <p> I guess that if you want to put the template under revision control you would have to your modules/templates-name into revision control, don&#39;t hold me on that though!!!</p> <blockquote> <p> * An easy way to update changes to the templates (without wiping everything)&nbsp;</p> </blockquote> <p> I never had the need to do that since I just edit my template that&#39;s deployed under modules.</p> <p> I had always good luck creating a new template set in studio, changing &#39;stuff&#39; inside a war never really worked for me and always ended up in some sort of a problem, specially with that zip file in the war.</p> <p> So, best is to create a new template set, not based on anything (for me at least).</p> <p> Hope that helps a bit..</p>

  • Number of messages  185
    Registration date Jun 7, 2011
    0 (0 Good)
    0 (0 Bad)

    Re: Creating a template set (for dummies)

    by  madsbuus »  2011/06/07 18:03

    Hi Ries,

    Thanks for your reply. It helped me a lot. I struggled for a long time symlinking in a 'deployed' template set folder into tomcat/webapps/ROOT/modules, without stable success. I am not saying it didn't work at all, it was just not quite working, and I was not able to create a site based on it.

    Having a real folder in 'modules' works better.

    So, best is to create a new template set, not based on anything (for me at least).
     

    Creating a new template set actually creates the proper JCR stuff so that the template set shows up the right places (The name is jcr:title to start with smiley, but I edited that through the content manager.

    My plan for today is:

    * Create a 'full' jahia module (using the maven stuff)
    * Build it to a war file (which is bad practice for development IMO, restructuring, zipping,moving,unzipping,moving etc.)
    * let Jahia autodeploy it into the 'modules' folder.
    * Relink css/js/jsp back into source controlled folder
    * Edit zones in the studio, and then exporting the repository.xml and manually move it back into the source tree to commit it to source control.

    New developers will have to do the same thing, risking conflicts in the repository.xml

    I would still like to know if there's a 'proper' way to do all this, that satisfies both 'instant-reload' changes, and source control. IMO Maven is for 'releasing' things, not for sencond-to-second development.

    Regards,
    Mads

  • Re: Creating a template set (for dummies)
    2011/06/30 15:52

    madsbuus <p> Hi Ries,<br /> <br /> Thanks for your reply. It helped me a lot. I struggled for a long time symlinking in a &#39;deployed&#39; template set folder into tomcat/webapps/ROOT/modules, without stable success. I am not saying it didn&#39;t work at all, it was just not quite working, and I was not able to create a site based on it.<br /> <br /> Having a real folder in &#39;modules&#39; works better.</p> <blockquote> <div> <font class="Apple-style-span" color="#333333" face="Arial, Helvetica, sans-serif">So, best is to create a new template set, not based on anything (for me at least).</font></div> <div> <div> &nbsp;</div> </div> </blockquote> <p> Creating a new template set actually creates the proper JCR stuff so that the template set shows up the right places (The name is jcr:title to start with <img alt="smiley" height="20" src="https://www.jahia.com/modules/assets/javascript/ckeditor/plugins/smiley/images/regular_smile.gif" title="smiley" width="20" />, but I edited that through the content manager.<br /> <br /> My plan for today is:<br /> <br /> * Create a &#39;full&#39; jahia module (using the maven stuff)<br /> * Build it to a war file (which is bad practice for development IMO, restructuring, zipping,moving,unzipping,moving etc.)<br /> * let Jahia autodeploy it into the &#39;modules&#39; folder.<br /> * Relink css/js/jsp back into source controlled folder<br /> * Edit zones in the studio, and then exporting the repository.xml and manually move it back into the source tree to commit it to source control.<br /> <br /> New developers will have to do the same thing, risking conflicts in the repository.xml<br /> <br /> I would still like to know if there&#39;s a &#39;proper&#39; way to do all this, that satisfies both &#39;instant-reload&#39; changes, and source control. IMO Maven is for &#39;releasing&#39; things, not for sencond-to-second development.<br /> <br /> Regards,<br /> Mads</p>

  • Number of messages  8
    Registration date Jun 7, 2011
    0 (0 Good)
    0 (0 Bad)

    Re: Creating a template set (for dummies)

    by  rvt »  2011/06/07 18:03

    Mads,

    I am doing exactly the same thing right now, trying to figure out the best workflow....

    For a module (not template) I did use the maven archetype, but honestly the whole maving thing currently bites my in the rear. I have never worked with maven, but it seems a very slooooow system. Even re-compiling the simplest module takes 30 seconds, may be I am doing something wrong but I even seeing it calling the jahia repository to get version information for my module :

    
    Executing: /bin/sh -c cd /opt/develop/jRVTSearch && svn --non-interactive info

    May be a maven guru knows why that's happening, but I don't, I am used to eclipse and/or using eclipse+ant.

    So, my next try is 'just' to create a standard web-module in Eclipse that will do exactly the same as maven and go from there. Then I link the module back into eclipse for editing, and it seems like with glassfish + eclipse I do have hot-deployment of java classes during development.

    May be a maven guru or a Jahia tech person can chime in and lett us know best practice ;)

    Ries

  • Re: Creating a template set (for dummies)
    2011/06/30 15:53

    rvt <p> Mads,</p> <p> I am doing exactly the same thing right now, trying to figure out the best workflow....</p> <p> For a module (not template) I did use the maven archetype, but honestly the whole maving thing currently bites my in the rear. I have never worked with maven, but it seems a very slooooow system. Even re-compiling the simplest module takes 30 seconds, may be I am doing something wrong but I even seeing it calling the jahia repository to get version information for my module :</p> <pre> Executing: /bin/sh -c cd /opt/develop/jRVTSearch &amp;&amp; svn --non-interactive info</pre> <p> May be a maven guru knows why that&#39;s happening, but I don&#39;t, I am used to eclipse and/or using eclipse+ant.<br /> <br /> So, my next try is &#39;just&#39; to create a standard web-module in Eclipse that will do exactly the same as maven and go from there. Then I link the module back into eclipse for editing, and it seems like with glassfish + eclipse I do have hot-deployment of java classes during development.<br /> <br /> May be a maven guru or a Jahia tech person can chime in and lett us know best practice&nbsp;<img alt=";)" src="http://10.8.37.193/forum/images/smilies/icon_e_wink.gif" style="margin-top:0px;margin-bottom:0px;border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-style:initial;border-color:initial;" title="Wink" /><br /> <br /> Ries</p>

  • Number of messages  185
    Registration date Jun 7, 2011
    0 (0 Good)
    0 (0 Bad)

    Re: Creating a template set (for dummies)

    by  shuber »  2011/06/07 18:03

    Hi guys, 

    Thanks for the feedback and for trying out Jahia.

    Actually the way I do it, is the following : 

    1. Copy an existing module's source (from one of Jahia's default ones)
    2. Edit things in the Maven project
    3. Deploy updates with "mvn install jahia:deploy"

    It is true that Maven is slower than direct editing of the files in the deployed area, so sometimes I simply edit the deployed file and copy back to the source the changes when I'm happy with them.

    This is not an ideal workflow, and it's pretty similar to what you are describing. I hope we'll be able to improve this in the future, and of course any suggestions are welcome.

    Regards,
    Serge Huber.

    Serge Huber (shuber)

    Number of messages  271
    Registration date
    0 (0 Good)
    0 (0 Bad)

    Re: Creating a template set (for dummies)

    by  rvt »  2011/06/07 18:03

    Serge,

    there was a post by Sergiy about using the Filesync module that can be added to Eclipse. So instead of linking back, I use the filesync module with great success. 

    See: viewtopic.php?f=19&t=540&sid=e605bb3f1ae9b550d209fe6b4e7ec9df#p2079

    What I also did is instead of using the maven archetype I just created a dynamic webmodule within eclipse with the same file structure as what the archetype created. The only problem I have once a while is that hot-deployment fails and I need to restart Jahia, this adds some extra time to the mix but apart from that it works fine. Appart from that, I don't think I miss anything not using maven... do I??

    Ries

  • Re: Creating a template set (for dummies)
    2011/06/30 15:54

    rvt <p> Serge,<br /> <br /> there was a post by Sergiy about using the Filesync module that can be added to Eclipse. So instead of linking back, I use the filesync module with great success.&nbsp;<br /> <br /> See:&nbsp;<a href="http://www.jahia.org/forum/viewtopic.php?f=19&amp;t=540&amp;sid=e605bb3f1ae9b550d209fe6b4e7ec9df#p2079">viewtopic.php?f=19&amp;t=540&amp;sid=e605bb3f1ae9b550d209fe6b4e7ec9df#p2079</a><br /> <br /> What I also did is instead of using the maven archetype I just created a dynamic webmodule within eclipse with the same file structure as what the archetype created. The only problem I have once a while is that hot-deployment fails and I need to restart Jahia, this adds some extra time to the mix but apart from that it works fine. Appart from that, I don&#39;t think I miss anything not using maven... do I??<br /> <br /> Ries</p>

  • Number of messages  185
    Registration date Jun 7, 2011
    0 (0 Good)
    0 (0 Bad)

    Re: Creating a template set (for dummies)

    by  shuber »  2011/06/07 18:03

    Maven is really useful to provide a project structure that is common to all projects, and once developers learn it, they can then quickly know their way around any project. Also, you benefit from all the plugins that are available such as reporting ones (javadoc, code quality, etc), packaging, etc...

    But in Jahia's deployment, we have no requirement for the project to be done with Maven. You could very well build your module by hand, using Ant or whatever tool you prefer. I don't use Eclipse myself so I can't use the FileSync plugin, but I actually am using Maven smiley

    Regards,
    Serge Huber.

    Serge Huber (shuber)

    Number of messages  271
    Registration date
    0 (0 Good)
    0 (0 Bad)

    Re: Creating a template set (for dummies)

    by  madsbuus »  2011/06/07 18:03

    Hi again,

    I ended up copying everything from another modules and fiddle with the files, removing the unwanted stuff, and modifying the pom.xml. For template modules, you need to make sure you have the import/zip stuff in the pom so that maven can zip the repository.xml into import.zip.

    I have created a symlink from the shared_modules folder to my target war file, so Jahia reloads it immediately after build.

    I then have a small script that i run a few seconds later that replaces all css script html folder with symlinks to my original source dirs. In that way I can easily edit my source and see changes reflected.

    !!! REMEMBER TO ADD 'allowLinking="true" to the <Context> element in tomcat before using symlinks.

    Hope that helps others a bit.


    Regards,
    Mads

  • Re: Creating a template set (for dummies)
    2011/06/30 15:56

    madsbuus <p> Hi again,<br /> <br /> I ended up copying everything from another modules and fiddle with the files, removing the unwanted stuff, and modifying the pom.xml. For template modules, you need to make sure you have the import/zip stuff in the pom so that maven can zip the repository.xml into import.zip.<br /> <br /> I have created a symlink from the shared_modules folder to my target war file, so Jahia reloads it immediately after build.<br /> <br /> I then have a small script that i run a few seconds later that replaces all css script html folder with symlinks to my original source dirs. In that way I can easily edit my source and see changes reflected.<br /> <br /> !!! REMEMBER TO ADD &#39;allowLinking=&quot;true&quot; to the &lt;Context&gt; element in tomcat before using symlinks.<br /> <br /> Hope that helps others a bit.<br /> <br /> <br /> Regards,<br /> Mads</p>

  • Number of messages  8
    Registration date Jun 7, 2011
    0 (0 Good)
    0 (0 Bad)

    Re: Creating a template set (for dummies)

    by  alexandre »  2011/06/07 18:03

    Hello,
    I am now able to create a template set by copying an existing one from Jahia's subversion repository, i can place my containers, do my own design and css but i still don't understand how to create different page templates, for sure i can use the studio but it isn't the best way to create some nice css, can someone give me a hint on how to proceed ?
  • Re: Creating a template set (for dummies)
    2011/06/07 18:03

    alexandre Hello,<br/>I am now able to create a template set by copying an existing one from Jahia's subversion repository, i can place my containers, do my own design and css but i still don't understand how to create different page templates, for sure i can use the studio but it isn't the best way to create some nice css, can someone give me a hint on how to proceed ?

  • Number of messages  9
    Registration date Jun 7, 2011
    Contact
    Share
    Feedback

    Get in touch

    Whether you are a current user or if you are just evaluating Jahia, we are here to help.

    Contact us

    Share this page