Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / March 2008



Tip: Looking for answers? Try searching our database.

format cfinclude

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rcain37 - 31 Mar 2008 15:38 GMT
I have over a thousand files that are headers to other files.  Some headers are
really long and I want to limit the output to a maximum of 40 characters,
instead of outputting the file name.   I know this example doesn't work but
this is how I would output the first 40 characters if if were in a database.  
<cfinclude template="#left(filename, 40)#">
Azadi - 31 Mar 2008 16:10 GMT
> I have over a thousand files that are headers to other files.  

surely there must be a better way to do what you are doing with those
thousands of files...

> Some headers are
> really long and I want to limit the output to a maximum of 40 characters,
> instead of outputting the file name.  

very confusing... you want to limit the output of what? what filename
are you talking about?

if you want to limit the output of your cfincluded file, then you have
to do it within that file. you can;t do it from the calling page, short
of reading it in with cfhttp or alike, parsing its contents, shortening
it to 40 chars, writing it to disk as a file and then cfincluding that
file...

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Rcain37 - 31 Mar 2008 17:03 GMT
> I have over a thousand files that are headers to other files.

>>surely there must be a better way to do what you are doing with those
thousands of files...

Yes a database would be nice but these files are updated in a different
department and then given to us and they are updated a few times a year.  
There are over 24,000 files and a certain number of those files are headers for
different sections.  I can distinguish which files are headers, by their file
names, but I want to be able to output the content inside the file instead of
the name of the file.  

Here is the page I'm trying to improve.  
http://www.legis.state.wv.us/WVCODE/Code.cfm

Where it says 1-1 in the left hand column, I want that to say "ARTICLE 1.
LIMITS AND JURISDICTION.", that is the text that is in the file.  Each
hyperlink in the left hand column is an individual page.   I was wondering if
anyone knew how to replace 1-1 with the text of the document.   I could use a
cfinclude to output "ARTICLE 1. LIMITS AND JURISDICTION." but it breaks up the
spacing in the left hand column because it outputs the entire page.
Azadi - 31 Mar 2008 17:15 GMT
without knowing how your files are formatted, your file naming
conventions, your folder structure and where the left menu links come
from and how they are formed, it is pretty much impossible to suggest
anything tangible...

the easiest way will probably be to have the article/section name in the
filename, which you can easily parse...

the harder way will be reading in a file and parsing the article/section
name out of its contents...

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Oguz.Demirkapi - 31 Mar 2008 16:15 GMT
If you would have interest on having full word on endings. I would suggest
something like following example.

<cfsavecontent variable="myContent">Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Etiam cursus aliquam ipsum. Vestibulum at ante. In bibendum
placerat augue. Nullam posuere. Praesent vitae nisl. Proin rhoncus diam
consequat diam. Donec in dui. Sed hendrerit hendrerit eros. Vestibulum diam
orci, bibendum non, fermentum sed, lobortis vitae, eros. Nunc tempor, urna sed
gravida sodales, nulla leo consectetuer nunc, eget sagittis mi lacus id
diam.</cfsavecontent>

<cfset maxChar = 150>
<cfset tempContent = Left(myContent,maxChar)>
<cfset myTruncatedContent =
ListDeleteAt(tempContent,ListLen(tempContent,CHR(32)),CHR(32))>
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.