Click here to register.
      
Sprechen Sie WebGUI? Parlez vous WebGUI? Se habla WebGUI? Spreekt u WebGUI?

Do you speak WebGUI? Please help us translate WebGUI into your language.



     WebGUI Templates Working Group > Recurring classes and IDs - generic asset template

Recurring classes and IDs - generic asset template

User rogier
Date 9/22/2008 5:53 am
Views 1115
Rating 0    Rate [
|
]
Previous · Next
User Message
rogier
rogier

To get the discussion started I made a template which includes:

  • code, classes and IDs that can be found found in all assets: containing div, anchor, controls, description
  • recurring classes: attachment loop and pagination

 

-----

<div id="[assetname]<tmpl_var assetId>" class="[assetname] [specific asset]">

<a name="id<tmpl_var assetId>" id="id<tmpl_var assetId>"></a>

<tmpl_if session.var.adminOn>
    <tmpl_var controls>
</tmpl_if>

<tmpl_if displayTitle>
    <h3><tmpl_var title></h3>
</tmpl_if>

<tmpl_if description>
    <div class="description">
        <tmpl_var description>
    </div>
    <!--/description-->
</tmpl_if>

<tmpl_loop attachment_loop>
    <tmpl_if __FIRST__>
        <div class="attachments">
        <ul>
    </tmpl_if>

    <tmpl_if isImage>
        <li><a href="<tmpl_var url>"><img src="<tmpl_var thumbnail>" alt="<tmpl_var filename>" class="wg-attach" /></a>
        <a href="<tmpl_var url>"><tmpl_var filename></a></li>
    <tmpl_else>
        <li><a href="<tmpl_var url>"><img src="<tmpl_var icon>" alt="<tmpl_var filename>" class="wg-attach" /></a>
        <a href="<tmpl_var url>"><tmpl_var filename></a></li>
    </tmpl_if>

    <tmpl_if __LAST__>
        </ul>
        </div>
        <!--/attachments-->
    </tmpl_if>
</tmpl_loop>

<div class="wg-clear"></div>

<tmpl_if pagination.pageCount.isMultiple>
    <div class="pagination">
        <tmpl_var pagination.previousPage> &#183; <tmpl_var pagination.pageList.upTo20> &#183;<tmpl_var pagination.nextPage>
    </div>
    <!--/pagination-->
</tmpl_if>

</div>
<!--/[assetname]<tmpl_var assetId> /[assetname] [specific asset]-->

-----



Back to Top
Rate [
|
]
 
 
rogier
rogier

And once more with comments (also attached as html):

 

-----

<div id="[assetname]<tmpl_var assetId>" class="[assetname] [specific asset]">
//id with assetname and assetID
//class with assetname and optional specific version of asset (e.g. article with image)
//example: <div id="article<tmpl_var assetId>" class="article withImage">

<a name="id<tmpl_var assetId>" id="id<tmpl_var assetId>"></a>
//anchor tag

<tmpl_if session.var.adminOn>
    <tmpl_var controls>
</tmpl_if>
//controls

<tmpl_if displayTitle>
    <h3><tmpl_var title></h3>
</tmpl_if>
//title is always h3 for assets (h1 is title in style template, h2 is title in page layout)

<tmpl_if description>
    <div class="description">
        <tmpl_var description>
    </div>
    <!--/description-->
</tmpl_if>
//description in class, since description is not always in p tags
//makes it possible to design a general description (.description) or an asset specific one (.article .description)
//note: comment at the closing tag

<tmpl_loop attachment_loop>
    <tmpl_if __FIRST__>
        <div class="attachments">
        <ul>
    </tmpl_if>

    <tmpl_if isImage>
        <li><a href="<tmpl_var url>"><img src="<tmpl_var thumbnail>" alt="<tmpl_var filename>" class="wg-attach" /></a>
        <a href="<tmpl_var url>"><tmpl_var filename></a></li>
    <tmpl_else>
        <li><a href="<tmpl_var url>"><img src="<tmpl_var icon>" alt="<tmpl_var filename>" class="wg-attach" /></a>
        <a href="<tmpl_var url>"><tmpl_var filename></a></li>
    </tmpl_if>

    <tmpl_if __LAST__>
        </ul>
        </div>
        <!--/attachments-->
    </tmpl_if>
</tmpl_loop>
//recurring attachments class
//opening and closing div and ul are inside the loop to prevent empty tags
//class "wg-attach" replaces inline styles, css is .wg-attach{border:0;vertical-align:middle;}
//"wg" prefix indicates that styles are defined in general webgui.css stylesheet
//note: comment at the closing tag

<div class="wg-clear"></div>
//strategically placed clearing div for clearing floated elements
//class "wg-clear", css is .wg-clear{clear:both;}
//"wg" prefix indicates that styles are defined in general webgui.css stylesheet
//note: comment at the closing tag

<tmpl_if pagination.pageCount.isMultiple>
    <div class="pagination">
        <tmpl_var pagination.previousPage> &#183; <tmpl_var pagination.pageList.upTo20> &#183;<tmpl_var pagination.nextPage>
    </div>
    <!--/pagination-->
</tmpl_if>
//recurring pagination class
//note: comment at the closing tag

</div>
<!--/[assetname]<tmpl_var assetId> /[assetname] [specific asset]-->
//closing tag for asst container div
//note: comment at the closing tag

-----

Please let me know what y'all think. Does the above make sense to you? Is this a good way of going about these things or is posting template code confusing?

 

Rogier | United Knowledge
www.unitedknowledge.nl · www.webgui-help.nl



Attached Files
Back to Top
Rate [
|
]
 
 
dionak

Rogier,

This makes sense to me. My only comments are:

* Is the div surrounding the attachments ul just for a 'hook' for css?

* Instead of clearing with a div, I suggest changing that to a br element. It's not really a page division.

* What template is this?

Diona

----
Knowmad Technologies
http://www.knowmad.com



Back to Top
Rate [
|
]
 
 
rogier
rogier

* Is the div surrounding the attachments ul just for a 'hook' for css?

That, and for positioning of the attachments as well. It's not really necessary, but I think that designers would find it easy to have each element (or at least many elements) of a template in a containing div.

If you're worrying about divitis, we could remove the div and add the "attachments" class to the ul and that'll work as well.

 

* Instead of clearing with a div, I suggest changing that to a br element. It's not really a page division.

Fine by me.

 

* What template is this?

I just picked the pieces of code that reccur in many, if not all, templates. Together it's allmost an article template. I didn't want this to be a discussion just about the article, but more about setting some general rules for asset templates.

 

Rogier | United Knowledge
www.unitedknowledge.nl · www.webgui-help.nl



Back to Top
Rate [
|
]
 
 
dionak

 

 

 I think that designers would find it easy to have each element (or at least many elements) of a template in a containing div.

If you're worrying about divitis, we could remove the div and add the "attachments" class to the ul and that'll work as well.

I can see how the div would be useful. It's fine. I just want to keep an eye on markup overuse.

 

 

Diona

----
Knowmad Technologies
http://www.knowmad.com



Back to Top
Rate [
|
]
 
 
rogier
rogier

I can see how the div would be useful. It's fine. I just want to keep an eye on markup overuse.

And I'm glad you do! Other comments, anyone?

 

Rogier | United Knowledge
www.unitedknowledge.nl · www.webgui-help.nl



Back to Top
Rate [
|
]
 
 
tabb
tabb

I think this looks very good.  I agree that wrapping things in a containing div is useful for positioning elements.



Back to Top
Rate [
|
]
 
 

Recent Discussions Color Key

Design:

Development:

Et Cetera:

Install/Upgrade:  

Smoketest:

Template Group:


Re: Navigation links by rogier - Fri @ 04:06pm

Re: Navigation links by techwriter - Fri @ 03:23pm

Re: Best way to make files available to webgui comunity by bernd - Fri @ 02:50pm

Re: User event history by knowmad - Fri @ 02:02pm

Re: Best way to make files available to webgui comunity by lctn2 - Fri @ 01:55pm

Re: Strategic Roadmap by JT - Fri @ 01:55pm

Re: Navigation links by rogier - Fri @ 01:55pm

Re: 2009 Presidents Meeting by JT - Fri @ 01:10pm

Re: navigation new window by rogier - Fri @ 01:03pm

Re: navigation new window by rogier - Fri @ 12:53pm

Re: WUC 2009 by JT - Fri @ 12:50pm

Re: Best way to make files available to webgui comunity by preaction - Fri @ 12:35pm

Re: Pagination markup by rogier - Fri @ 12:35pm

Re: Best way to make files available to webgui comunity by kristi - Fri @ 12:29pm