Help - Search - Members - Calendar
Full Version: Modules
Movable Type Community Forum > Additional Resources > Tips and Tricks
brazza
Maybe I am getting in way over my head, but I have a question.

Let's say I have ten different boxes on my site.  They are all exactly the same, except that the title of each one is different.

I made a module for the first one.  Do I really have to make nine more - just so that the title is different - or is there a way to change the parameters so that all I have to do is indicate the title when I call the module?

This might be something having to do with a language I don't know, but I thought I would ask first.  Thanks.
kadyellebee
Is there a reason why you'd need 10 copies?  Could you just use the single module for including?  Maybe if we knew what you were trying to do, it might make more sense smile.gif

Depending on where you are including the module, is the title related to that archive name, so you could use an MT tag there and use the module to be included below that?  If you were to have the ability to use PHP, where you could set up some if statements to output different titles depending on where the file was being included...  

Kristine
brazza
Ten different boxes on ten different pages.

Each module is a section of links with a specific image-based format. I just don't want to code them by hand each time on every page, which is why I am looking to use modules.

Unfortunatly I have a fear of PHP...i'll get there eventually but I am still learning more of the basics for now. smile.gif Maybe this will have to wait?
girlie
I may still be a little fuzzy on what you want.

In these boxes, everything is identical except the title of the box?

Then why not create one module with the identical stuff, and code the title of the box on the page itself?

Otherwise, I guess I don't understand the difference between coding them by hand in ten different modules vs. coding them by hand in ten different pages (templates). Copy and paste seems pretty easy to me.

And otherwise to that, PHP might be the ticket after all. It's not as intimidating as you think.  ;)
brazza
QUOTE
In these boxes, everything is identical except the title of the box?

Then why not create one module with the identical stuff, and code the title of the box on the page itself?


Yes.  Everything but the title.  But how do I code the title of the box on the page itself if the title is inside the box?

Am I being really thick? tongue.gif
girlie
Show us an example of the code you're putting in the module (use the CODE button: press CODE, paste template, press CODE again).
brazza
Sure.

CODE
<table width="180" border="0" cellspacing="0" cellpadding="0" align="center">
 <tr>
     <td width="30" height="30" rowspan="2"><img src="http://www.brazzastreet.com/images/Ecgh.gif" width="30" height="30"></td>
     <td width="120" height="2" bgcolor="#FFEAB5"></td>
     <td width="30" height="30" rowspan="2"><img src="http://www.brazzastreet.com/images/Ecdh.gif" width="30" height="30"></td>
 <tr>
     <td>
   <table cellspacing="0" cellpadding="0" border="0">
   <tr>
       <td width="120" align="center" height="28" bgcolor="#FFFFFF" class="headtitle" background="http://www.brazzastreet.com/images/T1.gif">TITLE GOES HERE!!!!!</td>
   </tr>
   </table>
     </td>
 </tr>
 <tr valign="top">
     <td colspan="3" bgcolor="#FFFFFF">
   <table width="180" border="0" cellspacing="0" cellpadding="0">
         <tr>
             <td width="2" bgcolor="#FFEAB5"></td>
               <td width="15"></td>
               <td width="145">
     <table width="145" border="0" cellspacing="0" cellpadding="0" align="center">
       <tr>
         <td valign="top" align="left" class="blog">
       <li><a href=/r/DOSSIERS>Dossiers de presse</a></li>
       <li><a href=/r/MANIFEST>Manifestations</a></li>
         </td>
       </tr>
     </table>
       </td>
         <td width="16"></td>
               <td width="2" height="50" bgcolor="#FFEAB5"></td>
         </tr>
      </table>
     </td>
 </tr>
 <tr>
     <td rowspan="2" width="30" height="30"><img src="http://www.brazzastreet.com/images/Ecgb.gif"></td>
     <td width="120" height="28" bgcolor="#FFFFFF"></td>
     <td rowspan="2" width="30" height="30"><img src="http://www.brazzastreet.com/images/Ecdb.gif"></td>
 </tr>
 <tr>
     <td colspan="1" height="2"  bgcolor="#FFEAB5" valign="bottom"></td>
 </tr>
 </table><br>
 


The title is in caps about 10 or 15 lines down.  Sorry it's so messy...
girlie
QUOTE
Depending on where you are including the module, is the title related to that archive name, so you could use an MT tag there and use the module to be included below that?  If you were to have the ability to use PHP, where you could set up some if statements to output different titles depending on where the file was being included...  

I'll go back to Kristine's question, since I understand a little better now about what's in your module.

How do these titles relate to the page they'll appear on (meaning, why are they different on each page, etc.)?
almuhajabah
I've been reading some of brazza's posts in other forums and it sounds like he is trying to customize the look of various pages on his site depending on what category they are in. So my guess is that he might want to put the category name as the header.

On an individual entry archive page you can use the <$MTEntryCategory$> tag to generate the name of the category.

On a category archive page you can use the <$MTCategoryLabel$> tag to generate the name of the category associated with that archive page.

If I've got it all wrong, please let me know.
brazza
Yes, exactly, they are going to change according to their category name.  I'll test out almuhajabah's option and see what turns up.  Thanks!
nolageek
Or, you could use the excellent MTIfCategory plugin and say:

CODE
<table><tr><td>

<MTIfCategory name="puppies">Title for puppy page</MTIfCategory>
<MTIfCategory name="kitties">Title for kitty page</MTIfCategory>
<MTIfCategory name="fishies">Title for fish page</MTIfCategory>
<MTIfCategory name="snakies">Title for snake page</MTIfCategory>

</td></tr>
<tr><td>

Put content here.

</td></tr>
</table>


I use that at nolageek to have different looking Individual Archive pages for my photos category than I do for my journal category.
almuhajabah
The IfCategory plugin is an excellent option if you want to input more than just the category name. I use it in several places on my site as well, for instance I have some things that only show up on the page if the entry belongs to a certain category.

You can also use PHP. There are lots of ways to customize the appearance of your page depending on category while still using the same basic archive template smile.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.