List Info

Thread: including the file found by searchfile




including the file found by searchfile
user name
2007-01-17 18:40:00
I have a requirement to insert a HTML fragment at the bottom
of each
page (a "sponsored by" message), but just for
certain subtrees of the
site.  Basically, what I want to something like the
searchfile tag
that instead of outputing the file name, outputs the content
of the
file itself.  I know about the include tag, but I don't want
the stuff
that it wraps the content in, I just want it to include the
content
verbatim.  There doesn't seem to be an easy way to do this,
unless I'm
missing something obvious...

-- 
Alan Burlison
--

------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief surveys -
and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
MeshCMS-Discussion mailing list
MeshCMS-Discussionlists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesh
cms-discussion

Re: including the file found by searchfile
user name
2007-01-18 03:03:33
Alan Burlison wrote:
> Brain fade - you can mostly do this with the parse tag,
except that it
> doesn't search for the file.  How about adding a
parameter to the
> parse tag (search=yes) to get it to search in the same
way as the
> include searchfile module does?
> 
> On 18/01/07, Alan Burlison <alan.burlisongmail.com> wrote:
>> I have a requirement to insert a HTML fragment at
the bottom of each
>> page (a "sponsored by" message), but just
for certain subtrees of the
>> site.  Basically, what I want to something like the
searchfile tag
>> that instead of outputing the file name, outputs
the content of the
>> file itself.  I know about the include tag, but I
don't want the stuff
>> that it wraps the content in, I just want it to
include the content
>> verbatim.  There doesn't seem to be an easy way to
do this, unless I'm
>> missing something obvious...

Hi Alan,

you could put the parse module in a if statement checking
for the path:

<% if (pagePath.isContainedIn(myPath)) { %>
<cms:module name="parse:myfile.html"
location="foo" />
<% } %>

If the subtrees are not too many, this should work,
otherwise it becomes 
really ugly.

Luciano


------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief surveys -
and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
MeshCMS-Discussion mailing list
MeshCMS-Discussionlists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesh
cms-discussion

Re: including the file found by searchfile
user name
2007-01-18 05:21:33
> you could put the parse module in a if statement
checking for the path:
>
> <% if (pagePath.isContainedIn(myPath)) { %>
> <cms:module name="parse:myfile.html"
location="foo" />
> <% } %>
>
> If the subtrees are not too many, this should work,
otherwise it becomes
> really ugly.

I think it would be pretty ugly, as it needs changes to the
JSP for
each subtree you want to include a file in, as well as
adding the file
containing the HTML you want to insert.  This makes it a
non-starter
for my users.

I can think of two ways of doing this, either to extend the
parse
module to make it able to search for the file, or extend
the
searchfile module so that if you specify a parameter
(include=yes)
instead of outputting the name of the file it found, it
outputs the
content of the file.  I think the second approach is better,
and It's
only a couple of lines of code.

-- 
Alan Burlison
--

------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief surveys -
and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
MeshCMS-Discussion mailing list
MeshCMS-Discussionlists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesh
cms-discussion

Re: including the file found by searchfile
user name
2007-01-18 07:00:42
> Er... searchfile is a tag, not a module, you should
extend/create a
> module instead ;)

Why?

Why wouldn't <cms:searchfile include="yes"/>
be OK?

--
Alan Burlison
--

------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief surveys -
and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
MeshCMS-Discussion mailing list
MeshCMS-Discussionlists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesh
cms-discussion

Re: including the file found by searchfile
user name
2007-01-18 07:32:28
> It depends on how you want to use it. I just re-read
your first message
> and yes, a tag is better than a module in your case,
since modules are
> not inherited between pages.
>
> If you make the change, feel free to commit it.

OK, as soon as I get some time I'll get it sorted - thanks


-- 
Alan Burlison
--

------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief surveys -
and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
MeshCMS-Discussion mailing list
MeshCMS-Discussionlists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesh
cms-discussion

Re: including the file found by searchfile
user name
2007-01-18 08:22:04
Thanks 

> I had some time and did it, just need to commit.

-- 
Alan Burlison
--

------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief surveys -
and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
MeshCMS-Discussion mailing list
MeshCMS-Discussionlists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesh
cms-discussion

[1-6]

about | contact  Other archives ( Real Estate discussion Medical topics )