4 Replies Latest reply on Feb 4, 2008 2:32 PM by Peter Johnson

    custom portal + css images

    John Gerevich Newbie

      Could you help me in:

      I created a custom theme and a custom layout.
      I first put it in a custom dir (mylayout), but later I put it in the themes/maple dir instead.

      I put the appropriate lines into portal-layouts.xml and portal-themes.xml in portal-core/WEB-INF.

      My problem is, that even though the stylesheet for my layout gets loaded perfectly, the images do not. My images are in themes/maple/images and I reference them with paths like "images/myImage.gif".

      What am I doing wrong? I copied everything into maple dir, because I hoped the default themes were hardcoded and that might work, but it does not. Why aren't my image urls getting converted, where does the conversion occur?

      Where do I have to look for the solution?

      Thanks,
      John

        • 1. Re: custom portal + css images
          Peter Johnson Master

          You can package a theme in a war file with a layout like:

          mytheme.war
          + mystyles.css
          + WEB-INF/
           + portal-themes.xml
           + web.xml
          + images/
           + mylogo.gif
           + myicon.ico
           + <lots more images>


          The web.xml file is empty (just ) and the portal-themes.xml file contains:

          <themes>
           <theme>
           <name>mytheme</name>
           <link rel="stylesheet" id="main_css" href="/mystyles.css" type="text/css"/>
           <link rel="shortcut icon" href="/images/myicon.ico"/>
           </theme>
          </themes>
          


          In addition placing your theme under jboss-portal.sar/portal-core.war/themes is also acceptable, as long as you add the theme name to jboss-portal.sar/portal-core.war/WEB-INF/portal-themes.xml.

          (Based on your post, I think you have done the above steps.)

          If you want to use your theme as the default theme, you also need to change several files - do a search for the term "renaissance". Note, however, that you need to do this *before* you run the portal for the first time. If you have already run the portal, the best way to switch it to using your theme is to make that change in the management portlet.


          • 2. Re: custom portal + css images
            John Gerevich Newbie

            Thanks for the help, after your post, I saw the flaw in my thinking.
            Putting the theme into a seperate war was a very good idea, didn't notice that in the reference guide.

            Above putting the theme there, I also put my own layout too (and the whole portal for simplicity's sake), and with a bit of myportal-object.xml tweaking I don't have to use the management portlet either.

            If it's any help to anyone, my dir structure:

            mytheme.war
            + my_styles.css
            + mylayout.jsp
            + WEB-INF/
             + portal-layouts.xml
             + portal-themes.xml
             + myportal-object.xml
             + web.xml
             + jsp/
             + <my jsp files>
            + images/
             + mylogo.gif
             + myicon.ico
             + <lots more images>
            <etc...>
            


            portal-themes.xml:
            <themes>
             <theme>
             <name>my_theme</name>
             <link rel="stylesheet" id="main_css" href="/my_styles.css" type="text/css"/>
             <link rel="shortcut icon" href="/images/favicon.ico"/>
             </theme>
            </themes>
            


            portal-layouts.xml:
            <?xml version="1.0" encoding="UTF-8"?>
            <layouts>
             <layout>
             <name>my_layout</name>
             <uri>/index.jsp</uri>
             <uri state="maximized">/index.jsp</uri>
             <regions>
             <region name="left"/>
             <region name="center"/>
             </regions>
             </layout>
            </layouts>
            


            part of myportal-object.xml:
            ......
             <page>
             <page-name>MyPage</page-name>
             <properties>
             <property>
             <name>theme.renderSetId</name>
             <value>divRenderer</value>
             </property>
             <property>
             <name>theme.id</name>
             <value>my_theme</value>
             </property>
             <property>
             <name>layout.id</name>
             <value>my_layout</value>
             </property>
             <property>
             <name>order</name>
             <value>1</value>
             </property>
             </properties>
            
             <window>
             ...
             </window>
             .......
             </page>
            .....
            



            And if you by any chance are such a messy coder, that you're using tags in your layout, then you can reference your images in your .jsp via:
            <%
            String contextPath = request.getContextPath();
            %>
            ......
            <img src="<%=contextPath %>/images/yourPic.jpg"/>
            ......
            
            


            • 3. Re: custom portal + css images
              John Gerevich Newbie

              Is there any way to use my custom header.jsp and tabs.jsp without tinkering with default portal core files?

              • 4. Re: custom portal + css images
                Peter Johnson Master

                The typical mechanism for changing the header and tabs is to change the theme. (By changing tabs, I assume you mean their appearance - you can change which tabs appear by defining new pages - each page has its own tab.)

                The existing header and tabs are laid out in index.jsp files found in subdirectories of jboss-portl.sar/portal-core.war/layouts