Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Enumerate DCR
hkultraman
Hi all,
I am new comer to this forum.
Currently, I am trying to create a page to disaplay all the DCR files in the Data folder. Is there a way to do this?
Is there any sample code? I have tried to take a look on the <iw_iterate> but seems it cannot reference to all DCR files in the data folder into a list.
Is there a way to do this?
Regards,
Michael
Find more posts tagged with
Comments
iw_store
Hi,
You can write a cgi program to which you can pass path upto data directory, if you are using inside single data directory.If u are using in different category/datatype you can have two parameter one upto /templatedata and second from /templatedata to /data directory.Needs use of FORM API in the cgi progam to acheive your goal.And this script called by a call srver or an inline callout.
hkultraman
Forgive me if I am wrong.
Actually, I am tring to create a listing page. The listing page will contains a list of hyperlink. Our user will use DCT to enter the Hyperlink info.
For example:
Item Name: MSN
Item Description: Microsoft Portal Site
Item URL:
http://www.msn.com
Item Name: Yahoo
Item Description: Yahoo Portal Site
Item URL:
http://www.yahoo.com
etc...
By using this way, a record will result a DCR file in the data directory.
I would like to use presentation template to list all the records out. Accordint to the reply, it seems that I need to write a CGI program to do this.
BTW, is there any other method to do this?
Many thanks for anyone help.
Regards,
Michael
Adam Stoller
I think part of the problem is the vagueness of your question.
Presumably you are talking about creating / generating a page using a PT (and not getting a list of DCRs to choose from within a DCT/DCR via FormAPI as iw_store seemed to think - yes?)
You do not need a CGI script - just a command-line-oriented Perl script or PT.
A PT is essentially a Perl script (actually, to borrow a quote from one of the developers: it's an "arbitrary program written to process arbitrary input data and output arbitrary output data") - so if you treat it as one big iw_perl block you'll tend to find it easier to do what you want... assuming you know Perl. If you don't know Perl it becomes more difficult.
Do you know Perl?
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
hkultraman
BTW, is it possible to just use PT to do this?
If merely PT cannot do this. I can use Perl as I know Perl before.
BTW, what is the basic logic to enumerate the files in the "data" folder?
Is it just use Perl to browse through the "data" folder and get the list? if I got the list is it possible to have a custom sorting order?
Thanks.
Adam Stoller
To use a PT, I believe you will need to provide a DCR and output file on the command line - but you might be able to do it without one, the other, or both with iwpt_compile.ipl (haven't tried this).
The logic in the PT can be all Perl - use opendir()/readdir() and/or TeamSite:
irwalk to traverse through the data directory to get all the DCRs in the data directory.
It's your code - so you can sort it any way you want.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
Migrateduser
I'm pretty sure I'm misunderstanding what Adam is saying above, because it is fairly common to use iwpt_compile.ipl without the iw_pt-dcr option to do things like create listing pages and what not. As for the algorithm to actually generate the list, you could iterate the files in the directory. If there are large number of files, you may get better performance by using DAS to store the relevant fields in the db and use the DBI module in your PT to select it out at generation time.
Adam Stoller
Nah - you understood me correctly - I said I wasn't sure if you needed both arguments on the command line for iwpt_compile.ipl - because I wasn't sure - I haven't created a lot of "listing pages" -- but you filled in that gap.
If you have DAS already configured and working - by all means, take advantage of it to organize the order in which retrieve and process the DCRs in question.
If you do not have DAS already configured and working - I think you'd be better off just processing the directory like you would with any other perl code for processing directories.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com