Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

SILVERSTRIPE BOOK XML SITE TREE ISSUE


Go to End


40 Posts   6703 Views

Avatar
servalman

Community Member, 211 Posts

24 August 2010 at 11:19pm

Thank you for that quick answer

It works (I guess it also work for level 3 items) !

Very nice of you

Know the oonly thing I would need ist to have the URL as a string do I have to create a function in the php file or is there something that can be used in the template like $CurrentLink

<node id="$ID" label="$Title" isBranch="true" classname="$ClassName" url="$CurrentLink">
<% control Children %>
$ExportContent
<% end_control %>
</node>

Thanks again I will try it with flash & let you know ohw it goes

thomas

Avatar
bummzack

Community Member, 904 Posts

25 August 2010 at 12:55am

Glad it worked. It will also work for level 3 and any other level below (since it's basically recursive).

You can use $Link to get the link or $AbsoluteLink if you need the full URL.

Avatar
servalman

Community Member, 211 Posts

25 August 2010 at 1:04am

Thanks

It is going to be extremly useful !

Now I will take care of the flash nav more easely since it is just going to process the xml .

I'm sure I will have some other question :)

Thomas

Avatar
servalman

Community Member, 211 Posts

25 August 2010 at 1:28am

Hello Banal (that is the other question I was talkin about :))

I wanted you advice of ohw to implement the flash nav and spécifically how to transmit to flash the current page.

I was thinking of using a flashvar to do so sending to flash the $Link variable .

Is it the best way ?

T

Avatar
bummzack

Community Member, 904 Posts

25 August 2010 at 2:49am

I would probably pass the $ID via FlashVars, together with a link to the XML Site-Tree. The link to the XML would be something like $Link/export and also passed to flash using FlashVars.

If you have a lot of pages and a high traffic site, it's probably not a good Idea to render the whole Site-Tree to XML with every request. If that's the case, it would be better to write the Site-Tree to an XML file whenever a Page in the CMS was edited...

Avatar
servalman

Community Member, 211 Posts

25 August 2010 at 9:29pm

Hi Banal

I'm now into insterting flash élements in my site.

I'm ok with replacing flash content with images or text it works fine.

I was now thinkin of what you said about not exporting the all site tree all the time.

here is the site tree (I have attached an image to be clearer)

PRODUCTS (level 1)

PRODUCTS SECTION 1 (level 2)

PRODUCTMENU : product 1- product2-product3 tc (level 3)

PRODUCTS SECTION 2

Do you think it is possible using your techique to just create an xml export of the 3rd level so I don't update the all site tree all the time .
It would also allow me to make several flash movies corresponding to each navigation sections instead of just one .

Thanks again

Thomas

Attached Files
Avatar
bummzack

Community Member, 904 Posts

25 August 2010 at 11:10pm

What I meant was something a bit different. I was suggesting to export the XML to a static file whenever a Page changes in the CMS. That way, the export will only be triggered if somebody changes something in the CMS and not with each user-request. If you apply this technique, it's no problem to always export the full XML-Tree.
But your approach is a good idea too. Just exporting the bits of the XML-Tree you currently need seems like a good plan. It might cause some loading-delays though?

I think you could just create a new function on your Page_Controller and name it "exportchildren" or something along these lines. Then create a matching template Page_exportchildren.ss:

<% control Children %>
$ExportContent
<% end_control %>

That will then only export the structure of the children... so you can get the subtree of a page "product" by loading /product/exportchildren in flash.

Avatar
servalman

Community Member, 211 Posts

25 August 2010 at 11:40pm

Hello

I will try that and get back to you.

Regarding the URL for the export link in flash var I usually do the following :

ImageName bieng the Name of the image I use in the flash:

In my Page.php

public function FlashVar() {
return "myFlashVar=$this->ImageName";
 } 

In my Page.ss

<object width="$FlashWidth" height="$FlashHeight" type="application/x-shockwave-flash" data="assets/swf/$FlashName">
<param name="movie" value="/assets/swf/$FlashName" />
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<param name="flashvars" value="$FlashVar"/>
</object>

how would I write the FlashVar() function ?

Thanks Again