Jump to content

Recommended Posts

Posted

My site is organized with many categories - on some of the Categories links, when I click on the link, some of the links to the other categories will disappear. The Category name itself will still be there, but it won't be a link anymore.

 

The site is here: http://www.aftertastebliss.com/eatit

 

For example, if you click on the "Aladdin's" category on the left, the Categories "Baja Fresh" and "Vento's Pizza" stop being links and appear as text only. Any ideas why? Those seem to be the only two.

 

Also, I am using Recent Comments. Whenever I click on older entries, it seems like some of the newer comments are dropped off. Is this because they weren't comments yet when that entry was made? Is there any way around this so that I can always list the most recently made comments no matter what entry you are looking at?

 

THANKS!

Posted

Categories: It's hard to know for certain without seeing the code and templates you're using. I would guess that the difference in display on various category pages is due to the code for the sidebar actually being present in the Category Archive template. When you add new entries, MT only rebuilds what it considers to be the relevant weblog pages. In order for every category page to display the correct category listing, links, and post counts, MT would need to rebuild every category's archive page whenever an entry is created or edited, and MT does not do this. (MT would need to do the equivalent of a "Rebuild Site" every time you posted a new entry.)

 

I would suggest creating a new Index template for your sidebar, place just the template code for your sidebar in it, then include this new Index template's output file in every template where you want the sidebar to appear. As MT rebuilds all Index templates when an entry is created or edited, the category list will always be current, correct, and up to date, and because the one file would be included on every page where you display the sidebar, all pages will display the same.

 

Recent Comments: I believe this issue is cause by the same problem as above, except for comments instead of entries. In order for the Recent Comments to be updated on every page, MT would need to rebuild all Category Archive pages every time a new comment was submitted. (Making MT perform the equivalent of a "Rebuild Site" every time a new comment was submitted would bring most servers to their knees.)

 

If you follow my suggestion above and make your sidebar an Index template that can be included in your weblog pages, this should also fix the issue you're seeing with the Recent Comments in your sidebar.

 

Hope this helps...

Posted (edited)
then include this new Index template's output file in every template where you want the sidebar to appear.

 

Could you help me out with this part a little bit? So, this is what my sidebar code looks like

><div id="right">
<div class="sidebar">

<div id="categories">
<h2>Restaurants</h2>

<MTTopLevelCategories>
<MTSubCatIsFirst><ul></MTSubCatIsFirst>
<MTIfNonZero tag="MTCategoryCount">
<li><a href="<$MTCategoryArchiveLink$>" title="<$MTCategoryDescription$>"><MTCategoryLabel> (<$MTCategoryCount$>)</a>
<MTElse>
<li><MTCategoryLabel>
</MTElse>
</MTIfNonZero>
<MTSubCatsRecurse max_depth="3">
</li>
<MTSubCatIsLast></ul></MTSubCatIsLast>
</MTTopLevelCategories>
</div>

<div class = "archiveyear">
<h2>About the Site</h2>
<font size = 1><font face="verdana">This site is a listing of various restaurants in the Pittsburgh area.  Please leave comments often!</font></font>

<h2>About the Authors</h2>
<font size = 2><font face="verdana">
<a href="http://www.aftertastebliss.com/eatit/nate.html">Nate</a> / <a href="http://www.aftertastebliss.com/eatit/jess.html">Jess</a> / <a href="http://www.aftertastebliss.com/eatit/julie.html">Julie</a> / <a href = "http://www.aftertastebliss.com/eatit/kim.html">Kim</a>
</font></font>

<h2>Most Recent Comments</h2>
<ul><li>
<MTComments lastn="10" sort_order="descend">
<p><$MTCommentAuthorLink show_email="0"$> on <MTCommentEntry>
<a href="<MTEntryPermalink>#c<$MTCommentID$>"><$MTEntryTitle$></a>
</MTCommentEntry>
</MTComments>
</li></ul>
</div>
<P>

<h2>Ads</h2>
<script type="text/javascript"><!--
google_ad_client = "pub-1496540983920775";
google_ad_width = 180;
google_ad_height = 150;
google_ad_format = "180x150_as";
google_ad_type = "text_image";
google_ad_channel ="";
google_color_border = "000066";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_url = "008000";
google_color_text = "000000";
//--></script>
<script type="text/javascript"
 src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<p>
<script type="text/javascript"><!--
google_ad_client = "pub-1496540983920775";
google_ad_width = 180;
google_ad_height = 150;
google_ad_format = "180x150_as";
google_ad_type = "text_image";
google_ad_channel ="";
google_color_border = "000066";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_url = "008000";
google_color_text = "000000";
//--></script>
<script type="text/javascript"
 src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

<P>
<h2>Search</h2>

<div class="link-note">
<form method="get" action="<$MTCGIPath$><$MTSearchScript$>">
<input type="hidden" name="IncludeBlogs" value="<$MTBlogID$>" />
<label for="search" accesskey="4">Search this site:</label><br />
<input id="search" name="search" size="20" /><br />
<input type="submit" value="Search" />
</form>
</div>


<div class="link-note">
<a href="<$MTBlogURL$>index.rdf">Syndicate this site (XML)</a>
</div>

<MTBlogIfCCLicense>
<div class="link-note">
<a href="<$MTBlogCCLicenseURL$>"><img alt="Creative Commons License" src="<$MTBlogCCLicenseImage$>" /></a><br />
This weblog is licensed under a <a href="<$MTBlogCCLicenseURL$>">Creative Commons License</a>.
</div>
</MTBlogIfCCLicense>

<div id="powered">
Powered by<br /><a href="http://www.movabletype.org">Movable Type <$MTVersion$></a><br />    
</div>

</div>
</div>

 

Should I copy that whole thing into a new index template called Sidebar Index or something like that? Then how would I link the output file to my other templates? Sorry, I have never done that in MT before (I don't think!). Thanks for your help so far!

Edited by julie
Posted

I think I figured out how to do the MTInclude on my own... hopefully this works. Thanks very much for the idea!

Posted
I think I figured out how to do the MTInclude on my own... hopefully this works.  Thanks very much for the idea!

I don't believe using an MTInclude tag to include the file will work as you hope. The MTInclude tag inserts a complete copy of the included file where the tag appears in your template. In order for any change in the included file to be reflected on all of your category archive pages (such as the Recent Comments when someone posts a new comment), you would *still* have to rebuild your entire site.

 

Using a PHP or SSI include instead of the MTInclude tag would solve this issue. PHP and SSI includes do not include a copy of the included file; rather, they include the original file at the time the web page is being served to the browser. When a change is made to the included file (such as a new comment), as soon as the included file is rebuilt, the change would be visible immediately on every page without the need to rebuild your entire site.

  • 2 weeks later...
Posted

well, i'm back. and you were right. it seemed to me that things looked like they were working out, but i am still having the comments / disappearing categories problem. i actually did try the PHP include, but that didn't work out for me either. what happened was new posts would not show up on the main index page - only on their category archive pages. it was kind of the opposite problem of what was happening before. very frustrating... can you think of anything else i can try? i might just end up designing the site differently so i don't even have to deal with the stupid sidebar problems anymore. but i do like it how it looks now. *sigh*

Posted

i guess i should also point out that i have been using code for two sidebars - one to go on the main page and one to go on the category archive pages. they look identical with the exception that the category tags are MTTopLevelCategories on the archive pages and MTSubCategories on the main page, as per the suggestion i received here.

 

so on the category archive page i refer to the sidebar with the top level categories and on the main page i refer to the sidebar with the subcategories in my MTInclude. Could this be causing some of my anguish? I tried just making them both MTTopLevelCategories, but that didn't seem to fix the problem.

Posted

There's no need to use two different sidebars (main index page vs. category archive pages) - you can use the same sidebar for both (use the category one that has the MTTopLevelCategories tag to list the categories).

 

The use of PHP includes should not have affected new posts showing up on the main index page. Your main index page should be rebuilt when you post a new entry as long as your Main Index template is set to rebuild automatically. You may be experiencing a caching issue with your browser - try doing a refresh in your browser if you don't see a new entry on your main index page after you've posted it.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...