EasyCFM.COM ColdFusion Forums / Coding Help! / How do i create a Read More.

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: How do i create a Read More.

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

smootj
04-24-2003 @ 8:17 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 44
Joined: Apr 2003

How can i create a read more link from a database.

Webmaster
04-24-2003 @ 9:54 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Administrator
Posts: 4542
Joined: Jan 2002

What do you mean read more? As in a brief text of description?

If that's what you need, you'll need to do a Left(Description, 100)...(<a href="full.cfm?id=#id#">more</a>)

That gives you a general overview of what I mean.

Try coding it, and if you get stuck, let me know.

Thanks,
Pablo Varando

=====================================================

smootj
04-24-2003 @ 10:34 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 44
Joined: Apr 2003

yah thats what i want. how can i incorprate what you said into the cfm document?

CJ
04-25-2003 @ 12:22 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Administrator
Posts: 4262
Joined: Oct 2002

Pablo pretty much gave you the exact code.  not sure what you mean by 'how do i incorporate it into a CFM document'?



CJ
@ #coldfusion/DALNet
http://charlie.griefer.com

Redmanz
04-25-2003 @ 1:27 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 411
Joined: Oct 2002

okay sounds like you just want the code pre-written for you! Not something we do around here, what we try to do is help people who are helping themselves. What I would suggest next is put Pablo's suggested script (which will work great) in a text file. Store it somewhere for a spell. Than go into the tutorial section of this site and try out a couple of the easier tutorial that show how to display data being called from a database query. Once you have things displaying on a page...........than try and incorporate the code Pablo gave you...............And if you have any troubles with the tutorials.........jump back in here and ask for help giving code examples of where your problems are.............good luck!

Coldfusion Applications available:
http://www.ideaz.ca/rez_productions/active_projects/index.htm

smootj
04-25-2003 @ 4:27 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 44
Joined: Apr 2003

Yah well....

<CFOUTPUT query="recent_post">       
       
       <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>
      #TITLE#<br>
#Left(Post, 100)#...(<a href="blank.cfm?q=#PID#">more</a>)
     </td>
  </tr>
  <tr>
    <td class="signature"><div align="right">-- <a href="mailto:#email#">#UNAME# </a>#dateformat(DATE,"mm/dd")#</div></td>
  </tr>
</table>
     </cfoutput>  

For all of you that dont think I even tryed it...still for some reason it doesnt work. It always desplays the read more regaurdless if the text is bigger or smaller than 100 chars.

This message was edited by Webmaster on 4-25-03 @ 4:42 PM

Webmaster
04-25-2003 @ 4:44 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Administrator
Posts: 4542
Joined: Jan 2002

You have to see if it the text is bigger then 100 charatcers, you then have to apply code to check that out.

Here's an example:

<CFOUTPUT query="recent_post">      
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>
      #TITLE#<br>
       <cfif len(Post) gt 100>
      #Left(Post, 100)#...(<a href="blank.cfm?q=#PID#">more</a>)
       <cfelse>
       #Post#
       </cfif>
     </td>
  </tr>
  <tr>
    <td class="signature"><div align="right">-- <a href="mailto:#email#">#UNAME# </a>#dateformat(DATE,"mm/dd")#</div></td>
  </tr>
</table>
</cfoutput>


Thanks,
Pablo Varando

=====================================================

Redmanz
04-25-2003 @ 4:45 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 411
Joined: Oct 2002

Just a shot in the dark...........try scoping your outputs ie: #recent_post.TITLE# etc................other than that I can't see anything wrong with the code.....unless.......unless...........its in the query which I can't see!  

Nice to see  code to try help trouble shoot!

Coldfusion Applications available:
http://www.ideaz.ca/rez_productions/active_projects/index.htm


Website Designed and Developed by Pablo Varando.