Data

Topics: General, XSLT
Mar 10, 2011 at 3:22 PM

I want to use this data to allow the publisher to update urls for the navigation link without having access to the template.  I was thinking about creating a global datatype that the user can update and enter the new links.  Worked great, but I could not add the function string in my template without it giving me an error when saving.  It didn't like the function call in the <a href="<f MY CALL >"</a> .   Does anyone have an idea how I could accomplish something like this?  I am new to C1 so your help would be greatly appricated.

Thanks

Mar 10, 2011 at 3:35 PM

Could you post some details on what you entered and what error you got? Did you create an XSLT Function or something else for rendering the data?

It is easier to help if you provide some background on the steps you took and what error you got

Mar 10, 2011 at 7:59 PM

I have created a visual function using a global datatype.   The datalink worked, but when I tried to use the datalink within my href - I get an error.  Below is the code:

<p><a title="Test" href="<data:fieldreference fieldname="DonateLink" typemanagername="DynamicType:frontend.Donate_System_Links" xmlns:data="http://www.composite.net/ns/dynamicdata/1.0" />" target="_blank">"Testing</a></p>

Mar 10, 2011 at 10:25 PM

It isn't a valid xml code. Try the following:

<p><data:fieldreference fieldname="DonateLink" typemanagername="DynamicType:frontend.Donate_System_Links" xmlns:data="http://www.composite.net/ns/dynamicdata/1.0">

 Testing

</data:fieldreference></p>

 

Either way the most agile & effective way to write such functionality is to use xslt functions (http://docs.composite.net/C1/XSLT.aspx) if you aren't familiar with xslt yet it will take some time to get use to it, but once you'll get friendly with it, you'll love it :)  

Mar 10, 2011 at 10:52 PM

The data entered it the dataset is a URL.  I want to use this url in my function to create a link.  Is there a good way to do this?

Mar 10, 2011 at 11:12 PM

You would need to do either some XSLT or C# to transform the data into HTML - the Visual Function feature don't ley you go very far.

If you are not keen on C#/XSLT you could probably achieve your goal without any coding like this:

  1. Create a data type with a string field (unlimited length) and change the widget to the HTML editor.
  2. Add a piece of data to it and write up your link list using the visual html editor.
  3. Create a Visual Function for your type that just render the HTML field.
  4. Add a function call to this Visual Function to your template where desired.
  5. When user need to change the list she just go edit the data item, use the visual editor to change/add and save.