1. I prefer to use the following.

<cfa_siteelementgetparents
      datasource="#request.cfa.objectStore.dsn#"
      elementid="#request.cfa.siteModel.pageId#"
      r_stparents="stParents">

<cfsetting enablecfoutputonly="No"> <!--- Must use this in 1.5 because of a
boo-boo in the code --->

This will bring you back structure with the section(s) and the site object.
Look through the structure of elements for the parentComposistionId = 0,
this will be your site object. Then look for the element where the
parentComposistionId is the site object's id. And so on. This will save you
from having to do multiple <cfa_siteElementGet> calls.

2. As of 1.5 all site elements are implemented as objects. To create a
section object you simply use <cfa_contentObjectCreate> with the correct
properties.
                <!--- Update Object --->
                <cfscript>
                        stProp = structNew();
                        stProp.startURL = "/partner/partnersites/#pageName#.cfm";
                        stProp.AbsFilePath = "";
                </cfscript>
                <cfa_contentObjectCreate
                        typeId="SectionTypeId"
                        datasource=""
                        stProperties="#stProp#"
                >

After creating the site elements, you will need to refresh the site model.
One way to do this for the who application is through the
<cfa_refreshSiteModel> tag. There are a few others that deal with a section
refreshing or an element that you can use.
                <!--- Refresh site model --->
                <cfa_refreshsitemodel
                        datasource = "#request.cfa.objectStore.dsn#"
                >

The last time I built a dynamic section I used the <cfa_page> tag to create
the section and page elements, returned the pageId through the r_pageId
attribute and update the necessary elements afterwards. It looked something
like this.
                <!--- Back up the request.cfa.sitemodel and request.cfa.logging 
structure.
Also, turn off the logging --->
                <cfset siteModelBAK = duplicate(request.cfa.sitemodel)>
                <cfset loggingBAK = duplicate(request.cfa.logging)>
                <cfset request.cfa.logging.logpage = 0>
                <cfset request.cfa.logging.logsection = 0>
                <cfset request.cfa.logging.logcachedobjects = 0>

                <!--- Go ahead and create the site, section and page through the 
cfa_page
call  --->
                <cfscript>
                        siteName = "Nile";
                        sectionName = "Partners,Partner Area";
                        pageName = output.stPartner.companyName;
                </cfscript>

                <cfa_page
                        siteName="#siteName#"
                        sectionName="#sectionName#"
                        pageName="#pageName#"
                        dataSource="#request.cfa.objectStore.dsn#"
                        r_pageID="pageId"
                >

                <!--- Update Object --->
                <cfscript>
                        stProp = structNew();
                        stProp.startURL = "/partner/partnersites/#pageName#.cfm";
                        stProp.AbsFilePath = "";
                </cfscript>
                <cfa_contentObjectData
                        datasource="#request.cfa.objectStore.dsn#"
                        stProperties="#stProp#"
                        objectId="#pageId#"
                />


                <cfscript>
                        //Restore Site model
                        request.cfa.sitemodel = siteModelBAK;
                        request.cfa.logging = loggingBAK;
                </cfscript>

Last note, the Webtop does have a tag <cfa_activity> that it uses to create
the section elements that it uses for the Webtop menus but is specific to
the Webtop only.

Ben Elmore
Macromedia Spectra Product Evangelist

-----Original Message-----
From: Seth Hodgson [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 12, 2001 7:53 PM
To: Spectra-Talk
Subject: Cookie trails based on site layout model


This is a multi-part message in MIME format.

------=_NextPart_000_0087_01C0F360.205ED630
Content-Type: text/plain;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Two questions:

1. Is there a best practice for generating cookie trails using the site =
layout model?
I have implemented a cookie trail (home > section1 > section1.1 > etc.) =
using the site model as follows.

    <!--- Get information for this section --->
    <cfa_siteElementGet
      dataSource=3D"#request.cfa.datasource.dsn#"
      elementID=3D"#currentSectionID#"
      r_stElement=3D"stSection"
    >
   =20
    <!--- Get history using parentCompositionID of section site =
elements, starting with the current element --->
    <cfscript>
      bGetParent =3D 1;
      tempParentID =3D stSection.parentCompositionID;
      aParentHistory =3D ArrayNew(1);
    </cfscript>   =20
    <cfloop condition=3D"bGetParent">
      <!--- Grab parent site element --->
      <cfa_siteElementGet
        dataSource=3D"#request.cfa.datasource.dsn#"
        elementID=3D"#tempParentID#"
        r_stElement=3D"currentParent"
      >
      <!--- Check for it's composition type, if it's a section, add it =
to our history array, otherwise kill the loop --->
      <cfset bGetParent =3D 0>
      <cfif currentParent.compositionType eq "Section">
        <cfscript>
          ArrayAppend( aParentHistory, currentParent );
          tempParentID =3D currentParent.parentCompositionID;
          bGetParent =3D 1;
        </cfscript>
      </cfif> =20
    </cfloop>

Once the array of parent elements has been built it can be looped over =
for a variety of location or cookie trail displays. I started off by =
attempting to use cfa_siteElementGetParents, which returned a collection =
of unsorted parent elements that didn't appear to be terribly useful but =
I'm curious if there are more elegant approaches to the cookie trail =
problem floating around.


2. Programmatically creating sections.
Is it possible to generate site sections programmatically? I can't find =
anything in the Spectra API for this, but the Webtop performs this =
action. If anyone has experience with programatically creating sections =
in the site layout model, please let me know how you went about =
accomplishing this.

Cheers,
Seth

seth hodgson
[engineering specialist]
impossible, inc.
www.impossible.com
805.560.0508 x 230

------=_NextPart_000_0087_01C0F360.205ED630
Content-Type: text/html;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4522.1801" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Two questions:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>1. Is there a best practice for =
generating cookie=20
trails using the site layout model?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I have implemented a cookie trail (home =
&gt;=20
section1 &gt; section1.1 &gt; etc.) using the site model as=20
follows.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; &lt;!--- Get =
information for=20
this section ---&gt;<BR>&nbsp;&nbsp;&nbsp;=20
&lt;cfa_siteElementGet<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
dataSource=3D"#request.cfa.datasource.dsn#"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;=20
elementID=3D"#currentSectionID#"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
r_stElement=3D"stSection"<BR>&nbsp;&nbsp;&nbsp; =
&gt;<BR>&nbsp;&nbsp;&nbsp;=20
<BR>&nbsp;&nbsp;&nbsp; &lt;!--- Get history using parentCompositionID of =
section=20
site elements, starting with the current=20
element&nbsp;---&gt;<BR>&nbsp;&nbsp;&nbsp;=20
&lt;cfscript&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bGetParent =3D=20
1;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tempParentID =3D=20
stSection.parentCompositionID;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
aParentHistory=20
=3D ArrayNew(1);</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;=20
&lt;/cfscript&gt;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; &lt;cfloop=20
condition=3D"bGetParent"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!--- =
Grab=20
parent site element ---&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;cfa_siteElementGet<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
dataSource=3D"#request.cfa.datasource.dsn#"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;=20
elementID=3D"#tempParentID#"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;=20
r_stElement=3D"currentParent"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!--- Check for it's =
composition type,=20
if it's a section, add it to our history array, otherwise kill the loop=20
---&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;cfset bGetParent =3D=20
0&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;cfif =
currentParent.compositionType=20
eq "Section"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;cfscript&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;=20
ArrayAppend( aParentHistory, currentParent=20
);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
tempParentID =3D=20
currentParent.parentCompositionID;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;=20
bGetParent =3D 1;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;/cfscript&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/cfif&gt;&nbsp;=20
<BR>&nbsp;&nbsp;&nbsp; &lt;/cfloop&gt;<BR></DIV></FONT>
<DIV><FONT face=3DArial size=3D2>Once the array of parent elements has =
been built it=20
can be looped over for a variety of location or cookie trail displays. I =
started=20
off by attempting to use cfa_siteElementGetParents, which returned a =
collection=20
of unsorted parent elements that didn't appear to be terribly useful but =
I'm=20
curious if there are more elegant approaches to the cookie trail problem =

floating around.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>2. Programmatically creating =
sections.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Is it possible to generate site =
sections=20
programmatically? I can't find anything in the Spectra API for this, but =
the=20
Webtop performs this action. If anyone has experience with =
programatically=20
creating sections in the site layout model, please let me know how you =
went=20
about accomplishing this.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Cheers,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Seth</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>seth hodgson<BR>[engineering=20
specialist]<BR>impossible, inc.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><A=20
href=3D"http://www.impossible.com";>www.impossible.com</A><BR>805.560.0508=
 x=20
230</FONT></DIV></BODY></HTML>

------=_NextPart_000_0087_01C0F360.205ED630--

----------------------------------------------------------------------------
--
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/spectra_talk
or send a message to [EMAIL PROTECTED] with
'unsubscribe' in the body.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
------------------------------------------------------------------------------
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/spectra_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to