Help - Search - Members - Calendar
Full Version: MT entries in PHP includes
Movable Type Community Forum > Additional Resources > Tips and Tricks
vitamin-d
Okay, this is going to be a long question. But I'll cut to the chase, in case it's an easy one.

I have three blogs on one page. I'm using PHP. One blog occupies the entire left column. The other two are in the right column.  Check it out

My questions are:

1. Can I tell MT to put a fixed amount of space between entries? Specifically, I'd like less space in between entries in the right column?

2. Why do my divs flow into one another when I have MT tags in them?

Okay, so here are the details:

The left-column blog is the main blog, and the right column contains PHP includes (?) ...

CODE
<div class="sidebaritemlight">
<div class="sectiontitle">list-o-matic</div>
<? include('/home/WWW_pages/dlemoine/list/index.html'); ?>
</div>

<div class="sidebaritemlight">
<div class="sectiontitle">literary accessories</div>
<? include('/home/WWW_pages/dlemoine/reading/index.html'); ?>
</div>


Both right-column blogs the same index structure, so here's the code of where they're coming from:

CODE
<div class="list">
<div class="lilcontain">
<MTEntries>
<span class="item"><$MTEntryBody$></span>
</MTEntries>
</div>
</div>


And the styles, which are in the header of the index.

CODE
.list a:link {color: #000000;}
.list a:visited {color: #000000;}
.list a:hover {font-weight: bold; color: #000000;}
.list a:active {color: #000000;}

.lilcontain {
    padding: 5px 5px 5px 5px;
    }

.item {
    font-family: Georgia, Times New Roman, Times, serif;
    font-size: x-small;
    line-height: 1.1;
    }


The styles in effect on the main blog page are:

CODE
.sidebaritemlight {
    margin-bottom: 15px;
    background-color: #eee;
    }

.sectiontitle {
    padding: 3px 3px 3px 10px;
    border: 1px solid #ddd;
    margin-bottom: 5px;
    background-color: #fff;
    font-family: Georgia, Times New Roman, Times, serif;
    font-weight: bold;
    font-size: x-small;
    color: #666;
    text-align: left
    }


If I should include any more code, let me know, but hopefully this will be enough to start chipping away.

Thanks,

Doug
girlie
I'll have to leave the CSS to the experts (Kristine?) but I will give you this advice:

On the files that you're including, make sure that only the primary file has the head tags:

CODE
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>list-o-matic</title>


You've got multiple doctype declarations, HTML, head, meta, and title tags scattered through there, which are not only messy, but may cause some problems display-wise.

And of course, clean up the corresponding closing tags too.
kadyellebee
Definitely check out Girlie's suggestions.  You'll also want to combine all of the styles into the head of the main blog instead of having them spread out in the sections.

1. Fixed amount of space - so you want more space between the items here?:
QUOTE
with the USA.
S.T.P.: Journey Through America with the Rolling Stones


You can set the paragraph for that like this:
CODE
.lilcontain p {padding: 10px;}

That will tell the browsers that any P tags inside of lilcontain classes will get more padding.  Increase or decrease that padding amount as you like smile.gif

2.  I'm not sure I know what you are seeing - which divs are flowing together on your screen?

Post back and I'll help more!!
Kristine
vitamin-d
girlie and kadyellebee,

Thanks for your help. As you can probably tell, I'm learning simultaneously about CSS, PHP, and HTML, so I'm doing a fair amount of fumbling around in the dark.

So, when I cleaned up the div tags and the styles, I noticed that there are quite a few things that may or may not be affecting the appearance of the divs in the right column.

I'm going to try to sort it all out this evening, and I'll post again if I have any more specific questions.

Thanks.

Doug
vitamin-d
Okay, here's a clarification of my previous question:

How do I make the MTEntries appear closer together?

See the "literary accessories" on the right. I'd like them to have 5px of space between each entry. Have a look.

The code is all above in my first post.

Secondly, is there a way to auto-number entries? There must be.

Thanks again,

Doug
kadyellebee
1.  There's several ways to go about setting a fixed width around your items in the sidebar.  

I think that instead of this code:
I modified your posted code to show the change from span to div for your item class that is showing up in your source now
CODE
<div class="list">
<div class="lilcontain">
<MTEntries>
<div class="item"><$MTEntryBody$></div>
</MTEntries>
</div>
</div>

You might want to use this instead:
CODE
<div class="list">
<div class="lilcontain">
<MTEntries>
<div class="item"><$MTEntryBody convert_breaks="1"$><br></div>
</MTEntries>
</div>
</div>

That will turn off the P tags around your entries, which are adding extra padding, and since you have one line info, its easier to just turn them off than use workarounds in the stylesheet to take it out.
and then change your stylesheet .item class like this:
CODE
.item {
    font-family: Verdana, sans-serif;
    font-size: xx-small;
    line-height: 1.1;
padding-bottom: 5px;
padding-top: 0px;
padding-right: 0px;
padding-left: 0px;
    }

That should give 5px of space below each item.


2.  Your numbers are automatically numbered in the order that you post.  You could use
CODE
<$MTEntryID$> or <$MTEntryID pad="1"$>
to display the entry number or the padded entry number (56 vs. 000056)

Hope that helps!
Kristine
vitamin-d
Kristine!

Maybe 20% of my knowledge of CSS has come from the helpful responses you've given to people in this forum. Thanks!

Doug
kadyellebee
I'm always glad to help - and my css knowledge is one of my fav things, so sharing it makes sense!!!!

Kristine
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.