Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Blogging Forum


You are currently viewing our Blogging Forum as a guest. Please register to participate.
Login



Reply
How to make Read More link at blogger beta?
Old 01-17-2007, 11:55 AM How to make Read More link at blogger beta?
Average Talker

Posts: 23
Trades: 0
Please need help if any somebody here know how to make Read More link at blogger beta?

I hope step by step with example code.

Thank
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
funmastertalk is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-17-2007, 03:56 PM Re: How to make Read More link at blogger beta?
techwench's Avatar
Code Monkey

Posts: 1,449
Name: Danalyn
Location: Dallas, TX
Trades: 0
I posted this a while back, here, for the "old school" blogger...but the principle is the same. You'll probably have to edit the Blogger tags, since I'm sure they have changed since they switched to widgets.

1) Add this javascript code to your template's header (line just above </head>):

Code:
<script type="text/javascript" language="JavaScript">
	<!--
	function showMore(postId, postLink)
	{
		postBodyId = "postbody" + postId;
		showExtLink = "showlink" + postId;
		hideExtLink = "hidelink" + postId;
		if (document.getElementById)
		{
			var postElement = document.getElementById(postBodyId);
			var fullPostElement = null;
			var showExtLinkElement = document.getElementById(showExtLink);
			var hideExtLinkElement = document.getElementById(hideExtLink);
			// find fullpost div
			if (postElement)
			{
				for (var j = 0; j <postElement.childNodes.length; j++)
				{
					if (postElement.childNodes.item(j).className == "fullpost")
					{
						fullPostElement = postElement.childNodes.item(j);
						break;
					}
				}
				if (fullPostElement)
				{
					// show
					if (postLink != 0)
					{
						fullPostElement.style.display = "block";
						showExtLinkElement.style.display = "none";
						hideExtLinkElement.style.display = "block";
					}
					// hide
				else
					{
						fullPostElement.style.display = "none";
						showExtLinkElement.style.display = "block";
						hideExtLinkElement.style.display = "none";
						location.href = '#'+postId;
					}
					return false;
				}
			else
				{
					location.href = postLink;
					return true;
				}
			}
		else
			{
				location.href = postLink;
				return true;
			}
		}
	else
		{
			location.href = postLink;
			return true;
		}
	}
	function initShowLink (postId)
	{
		postBodyId = "postbody" + postId;
		showExtLink = "showlink" + postId;
		hideExtLink = "hidelink" + postId;
		if (document.getElementById)
		{
			var postElement = document.getElementById(postBodyId);
			var foundFullPostElement = 0;
			var showExtLinkElement = document.getElementById(showExtLink);
			var hideExtLinkElement = document.getElementById(hideExtLink);
			// find fullpost div
			if (postElement)
			{
				for (var j = 0; j <postElement.childNodes.length; j++)
				{
					if (postElement.childNodes.item(j).className == "fullpost")
					{
						foundFullPostElement = 1;
						break;
					}
				}
				if (foundFullPostElement == 1)
				{
					showExtLinkElement.style.display = "block";
					hideExtLinkElement.style.display = "none";
				}
			else
				{
					showExtLinkElement.style.display = "none";
					hideExtLinkElement.style.display = "none";
				}
			}
		}
	}
	//-->
</script>
2) in your stylesheet (just above </style>) add this:

Code:
.fullpost { 
	<MainOrArchivePage>
		display: none;
	</MainOrArchivePage>
	<ItemPage>
		display: block;
	</ItemPage>
}
3) Find the tag <$BlogItemBody$>. This is the tag that displays your post text. This tag might be between <p></p> or <div></div> tags.

4) Add this code to the opening <p> or <div> tag before the <$BlogItemBody$> tag:

Code:
 id="postbody<$BlogItemNumber$>"
So it looks like this:

Code:
<div id="postbody<$BlogItemNumber$>">

5) Add this code below those <p> or <div> tags surrounding the <$BlogItemBody$> tag:

Code:
<!--  START SHOW/HIDE MORE BLOCK  -->
<MainOrArchivePage>
<div style="display:block;" id="showlink<$BlogItemNumber$>"><a href="<$BlogItemPermalinkURL$>" onclick="showMore('<$BlogItemNumber$>', '<$BlogItemPermalinkURL$>');return false;">Read More &raquo;</a></div>
<div style="display:none;" id="hidelink<$BlogItemNumber$>"><a href="#" onclick="showMore('<$BlogItemNumber$>','');return false;">&laquo; Hide Post</a></div>
<script type="text/javascript" language="JavaScript">
	<!--
	initShowLink('<$BlogItemNumber$>');
	//-->
</script>
</MainOrArchivePage>
<!--  END SHOW/HIDE MORE BLOCK  -->
6) Save template.

7) Now, go to Settings >> Formatting, scroll down to the bottom and add this in the Post Template box and save:

Code:
<div class="fullpost"> </div>
7) Republish entire blog.

8) Now, any text you put above the <div></div> tags will show up on your main page, anything you but between the <div></div> tags will only show up on the main page when you click the read more (the read more link doesn't show on permalink pages, btw).

NOTE: You WILL have to edit each post indivitually to include these <div></div> tags where you want to hide the expanded post!!!

If you just want to write a short post, delete the div tags, and no read more link will display.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
techwench is offline
Reply With Quote
View Public Profile
 
Old 01-17-2007, 08:47 PM Re: How to make Read More link at blogger beta?
adrian88's Avatar
Extreme Talker

Posts: 245
Trades: 0
sounds complicated lol
__________________

Please login or register to view this content. Registration is FREE
|

Please login or register to view this content. Registration is FREE
|

Please login or register to view this content. Registration is FREE
|

Please login or register to view this content. Registration is FREE
!


Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
adrian88 is offline
Reply With Quote
View Public Profile Visit adrian88's homepage!
 
Old 01-20-2007, 11:01 AM Re: How to make Read More link at blogger beta?
astrojith's Avatar
Ultra Talker

Posts: 490
Trades: 0
Yeah. The only advantage blogger has, is its ease to use. If things start getting complicated like this, its better to switch over to Good ol' Wordpress. Blogger lacks a lot of powerful features and the code is inefficient. It also lacks flexibility.
__________________
Get FREE Science, Tech & Coding Ebooks :
Please login or register to view this content. Registration is FREE


astrojith is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to How to make Read More link at blogger beta?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.24270 seconds with 12 queries