Mike Britton wrote:

Yes - I was hoping someone had code I could look at for this.  I realize
it's a huge task to do something like batch loading for a feature-rich CMS
like farcry.  I would hire someone to do it manually but there are like
15,000 documents.  I wouldn't put something so tedious on someone when it
can be automated.

If you don't mind, I'd like to take a look at your functions for this.  It
would help me understand better what's necessary to extend farcry in this
way.


You can also look at the install scripts to see how FarCry objects are created from script.

farcry_core/admin/install/_createDefaultNodes.cfm

Your schedule task would need to determin the type of object it is (dmHTML if it's just a static site) and the you would need to loop over these new objects, create a dmHTML object (or other object), create a dmNavigation node (and reference the dmHTML object in aObjectIDs and finally attach the node to the tree.

It's pretty straight forward, you just set up the object structures and pass them to createData functions and use the tree methods to attache the dmNav to the tree.

I have attached a script that I use to convert URL references within my objects. Eg if I had a reference to localhost/images and now need it to use www.daemon.com.au/images I would run this script and it would go through all FarCry object and then each longchar field of these object and replace an oldString value with a newString value. Works fine for me but please backup your databases before running! :)

-Brendan
http://farcry.daemon.com.au







<cfsetting enablecfoutputonly="Yes">

<cfoutput>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
        <title>FarCry Migration</title>
</head>

<body>
</cfoutput>

<!--- oldString is string you want to replace --->
<cfset oldString= 'href="images/'>
<!--- newString is what you want to replace oldString with --->
<cfset newString= 'href="#application.url.webroot#/images/'>

<!--- loop through all types --->
<cfloop collection="#application.types#" item="type">
        <!--- loop through type properties --->
        <cfloop collection="#application.types[type].stProps#" item="prop">
                <!--- check for longchar --->
                <cfif application.types[type].stProps[prop].metadata.type eq 
"longchar">
                        <!--- get all records of current type that are longchar fields 
--->
                        <cfquery name="qAll" datasource="#application.dsn#">
                                select #prop#,objectid,label
                                from #application.dbowner##type#
                        </cfquery>
                        <!--- loop over records --->
                        <cfloop query="qAll">
                                <!--- try to update records with new string value --->
                                <cftry>
                                        <cfquery name="qUpdate" 
datasource="#application.dsn#">
                                                update #application.dbowner##type#
                                                set #prop# = 
'#replaceNoCase(qAll[prop][currentrow], oldString, NewString, "all")#'
                                                where objectid = '#qAll.objectid#'
                                        </cfquery>
                                        <!--- output record info --->
                                        <cfoutput>
                                                #type# (#prop#) - #qAll.label#<br>
                                        </cfoutput>
                                        <cfflush>
                                        <cfcatch>
                                                <cfdump var="#cfcatch#">
                                        </cfcatch>
                                </cftry>
                        </cfloop>
                </cfif>
        </cfloop>
</cfloop>

<cfoutput>
<strong><p>All done.</p></strong>
</body>
</html>
</cfoutput>

<cfsetting enablecfoutputonly="No">
---
You are currently subscribed to farcry-dev as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

Reply via email to