0
format cfinclude
New Here
,
/t5/coldfusion-discussions/format-cfinclude/td-p/364161
Mar 31, 2008
Mar 31, 2008
Copy link to clipboard
Copied
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)#">
<cfinclude template="#left(filename, 40)#">
TOPICS
Advanced techniques
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/format-cfinclude/m-p/364162#M32658
Mar 31, 2008
Mar 31, 2008
Copy link to clipboard
Copied
> 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/
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/
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Rcain37
AUTHOR
New Here
,
/t5/coldfusion-discussions/format-cfinclude/m-p/364164#M32660
Mar 31, 2008
Mar 31, 2008
Copy link to clipboard
Copied
> 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.
>>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.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
LATEST
/t5/coldfusion-discussions/format-cfinclude/m-p/364165#M32661
Mar 31, 2008
Mar 31, 2008
Copy link to clipboard
Copied
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/
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/
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Contributor
,
/t5/coldfusion-discussions/format-cfinclude/m-p/364163#M32659
Mar 31, 2008
Mar 31, 2008
Copy link to clipboard
Copied
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))>
<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))>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

