1
basby
wf-sections: layout and sections question
  • 2004/10/7 9:07

  • basby

  • Not too shy to talk

  • Posts: 109

  • Since: 2003/1/28


Hi,

I have two questions on wf-sections.

1. Is it possible to define different layouts for different sections?
2. Can an article be part of more than one section at the same time (without copying the article)?

Basby

2
basby
Re:wf-sections: layout and sections question
  • 2004/10/7 20:05

  • basby

  • Not too shy to talk

  • Posts: 109

  • Since: 2003/1/28


I thought I read somewhere that it was possible to have different layouts for different sections but I don't know where. Anyone who knows?

3
rcjohnson
Re:wf-sections: layout and sections question
  • 2004/10/7 21:13

  • rcjohnson

  • Not too shy to talk

  • Posts: 187

  • Since: 2004/7/23


I would post this into the check WF-PROJECTSforums.

The wf-projects team are very good at supporting help requests when they are submitted to thier site forums.

4
Draven
Re:wf-sections: layout and sections question
  • 2004/10/7 22:13

  • Draven

  • Module Developer

  • Posts: 337

  • Since: 2003/5/28


One way I can think of off the top of my head is to make the main section theme a switch. What I mean is, set it up to include a different template based on the section being viewed. Either by using the section id or some other variable set in the sections document to be used in smarty as a switch.

I do this all the time in my themes to allow different templates for different modules. By using the theme.html as a switch, I can include different templates for each module. So when someone is viewing the news module, the news.html theme is included into the theme.html template to beused for layouts specific to the news module.

Here's the code I use in my theme.html to make this happen:

<{php}>
if(
is_object($GLOBALS['xoopsTpl'])){
    
$mod $GLOBALS['xoopsModule'];
    
$dirname = (isset($mod) ? $mod->getVar('dirname') :'system');
    
$GLOBALS['xoopsTpl']->assign'xoops_cmod'$dirname );
}
<{/
php}>
<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<{$xoops_langcode}>" lang="<{$xoops_langcode}>">
  <
head>
          <
meta http-equiv="content-type" content="text/html; charset=<{$xoops_charset}>" />
          <
meta http-equiv="content-language" content="<{$xoops_langcode}>" />
          <
meta name="robots" content="<{$xoops_meta_robots}>" />
          <
meta name="keywords" content="<{$xoops_meta_keywords}>" />
      <
meta name="description" content="<{$xoops_meta_description}>" />
      <
meta name="rating" content="<{$xoops_meta_rating}>" />
          <
meta name="author" content="<{$xoops_meta_author}>" />
          <
meta name="copyright" content="<{$xoops_meta_copyright}>" />
          <
meta name="generator" content="XOOPS" />
          <{
$metaextra}>
          <
title><{$xoops_sitename}> - <{$xoops_pagetitle}></title>
          <
link href="<{$xoops_url}>/favicon.ico" rel="SHORTCUT ICON" />
          <
link rel="stylesheet" type="text/css" media="all" href="<{$xoops_themecss}>" />
          <
script type='text/javascript' src='/standard.js'></script>
          <!-- 
RMVadded module header -->
          <{
$xoops_module_header}>
          <{
$metaextra}>
          <
script type="text/javascript">
          <!--
          <{
$xoops_js}>
          
//-->
          
</script>
  </
head>
  <
body>
    <!-- If 
we are viewing a module other than the system modulethen include the module template -->
    <{if 
$xoops_cmod != "system" && $xoops_cmod != ""}>
        <{include 
file="marketing/$xoops_cmod.html"}>
    <{else}>
        <!-- 
otherwise use the system module-->
        <{include 
file="marketing/system.html"}>
    <{/if}>
  </
body>
</
html>


Basically the small section at the top is used to determine what module is currently being viewed:
<{php}>
if(
is_object($GLOBALS['xoopsTpl'])){
    
$mod $GLOBALS['xoopsModule'];
    
$dirname = (isset($mod) ? $mod->getVar('dirname') :'system');
    
$GLOBALS['xoopsTpl']->assign'xoops_cmod'$dirname );
}
<{/
php}>


Then in the body of the theme I invlude the appropriate theme for the module.

<!-- If we are viewing a module other than the system modulethen include the module template -->
    <{if 
$xoops_cmod != "system" && $xoops_cmod != ""}>
        <{include 
file="marketing/$xoops_cmod.html"}>
    <{else}>
        <!-- 
otherwise use the system module-->
        <{include 
file="marketing/system.html"}>
    <{/if}>


The way this works is it includes the module theme using Module_name.html. So in my themes folder I have a template for each module (example: news.html or wfsection.html).

If no module is found or the module variable is blank, like for the homepage, I include a default system.html template to be used.

You can get much more complex then this, but I won't get into that as it usualy has a limited application.

This ystem is nice for things like making the forum module 100%, while having the rest of the site in a fixed width.

5
basby
Re:wf-sections: layout and sections question
  • 2004/10/8 22:01

  • basby

  • Not too shy to talk

  • Posts: 109

  • Since: 2003/1/28


Thank you Draven! It is worthwhile to try out your suggestion. I also followed the suggestion by rcjohnson and posted the question at the wf-secions forum (with a link to this thread).

Thanks again!

6
Bender
Re:wf-sections: layout and sections question
  • 2004/10/8 23:33

  • Bender

  • Home away from home

  • Posts: 1899

  • Since: 2003/3/10


Great work from draven here as currently there is no easy way to do this.

Still this is on the list for the 3.x series of WF-Sections which is currently in the planning stages and will be a complete rewrite. Therefore it won´t be around for quite some time. =)

Login

Who's Online

227 user(s) are online (123 user(s) are browsing Support Forums)


Members: 0


Guests: 227


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits