Author
|
Message
|
Trond Åge Kvalø
|
Monday 16 February 2004 7:37:53 am
Can anybody tell me what is wrong here? I get no output and no debug errors. I'm running eZp 3.2-4
{let myAttribs = fetch('content','class_attribute_list',hash(class_id,2))}
{section name=mysection loop=$myAttribs}
<h3>$mysection:item.name</h3>
{/section} {/let} trondåge
trondåge
|
James Packham
|
Monday 16 February 2004 8:35:00 am
Don't you need specify a version for this type of fetch? e.g.
{let myAttribs = fetch('content','class_attribute_list',hash(class_id,2,version_id,5))}
{section name=mysection loop=$myAttribs}
<h3>$mysection:item.name</h3>
{/section} {/let} Regards, James If it still doesn't work it might be a problem with your section statement (I try to avoid using name for example) use {$myAttribs|attribute(show)} to find out what is and isn't going on :)
|
Trond Åge Kvalø
|
Monday 16 February 2004 8:46:19 am
Hi James! Thank you for the answer, but version is optional according to the docs. I don't know what was wrong, but I've somehow fixed it by using the following code, cut and paste from the docs about fetch:
{section loop=fetch( 'content', 'class_attribute_list', hash( 'class_id', 2 ) )}
<h3>{$:item.name|wash}</h3> {/section} As you can see, no name for the section here. Which puzzles me, because this is what the docs has to say about Sections: "Each section must have a name. The name will declare the unique namespace for this section. To access a variable in the namespace you have to add the name of the namespace to the variable. " But now it works at least. BTW: do you know if it's possible to store data directly from the template langugae? trondåge
trondåge
|
James Packham
|
Tuesday 17 February 2004 1:09:55 am
Yeah, I never usually bother to declare a name for my sections (extra fingerwork as well!) >> BTW: do you know if it's possible to store data directly from the template langugae? I'm not sure what you mean, are you talking about post variables or using input tags, or something else? Regards, James
|
Trond Åge Kvalø
|
Tuesday 17 February 2004 2:32:52 am
Hi again James. Here's a quick intro to hopefully make you grasp what we're talking about. We're creating a Learning Management Server based on eZpublish 3.2-4. The LMS will follow the SCORM standard as found on http://www.adlnet.org/ According to this standard we need to store variables with predefined variable names. We will POST these variables to eZpublish from an external Flash file. So now the storing part. I can use the ezhttp operator to display the posted variables in a template. But how would I go about to store/update let's say the title of an article with the posted variable. Would it be better/simpler to create our own database tables to store the SCORM data, or could we just set up different classes in eZp to store these data? How would we go about if we were to store and retrieve data from custom database tables in eZpublish? Lots of questions, and I don't expect you to know the answers to all of them :-) But that's what I'm struggling with at the moment. trondåge
trondåge
|
James Packham
|
Tuesday 17 February 2004 5:10:32 am
>> The LMS will follow the SCORM standard as found on http://www.adlnet.org/ Looks interesting, I'm supposed to be working on a project to do something similar but not for a while. I'd still be interested to find out how you get along :)
>> According to this standard we need to store variables with predefined variable names. We will
>> POST these variables to eZpublish from an external Flash file.
>> So now the storing part. I can use the ezhttp operator to display the posted variables in a template. >> But how would I go about to store/update let's say the title of an article with the posted variable. hhmmm I don't think I can tell you with anything that you haven't figured out for yourself on this I'm afraid. I'm definately not the best person to ask about integration between EZ Publish and Flash. Although I wouldn't have thought using templates to create and edit objects in your EZP database was the best way of going about it (I'm saying this with extremely limited knowledge of Flash) – shouldn't you be extending EZ Publish with PHP?
>> Would it be better/simpler to create our own database tables to store the SCORM data, or could we >> just set up different classes in eZp to store these data? How would we go about if we were to store >> and retrieve data from custom database tables in eZpublish? Depends if you want EZ Publish to manage the data. It's probably a lot easier to import it to a different database though. It might be worth looking at some of the contributions to importing data.
>> Lots of questions, and I don't expect you to know the answers to all of them :-) But that's what I'm >> struggling with at the moment. *Phew!* Sorry, but I just don't know enough about these things (particulary about the way flash works) to be that much help :) Regards, James
|
Trond Åge Kvalø
|
Tuesday 17 February 2004 5:27:15 am
Actullay Flash posts varaibles just like a standard web page. So to break it up a bit I've created a simple form with a standard textfield and a submit button. In the action attribute I have put an eZ URL (http://my.domain.no/index.php/content/view/full/61). Then I've created a template override for pagelayout.tpl for the article class (node 61 is an article object). In this template override I've put {ezhttp( 'ezCom_text', 'post' )} (and only that) to display the value that I've posted from the external web page. Node 61 is a standard article with a Title, an Intro, a Body, a Thumbnail and an Enable comment. Now I want to use the value that I've posted as the new Title of my article. Do you have any idea how I would do that? I would have thought that there was a template function to store data, just as there is a template function to retrieve data. But I'm beginning to think that I have to write an extension. I'll fill you in on the details as soon as I get a better grip on the concepts. (seems that I delayed too much before I began using eZp after the course....) trondåge
trondåge
|
James Packham
|
Tuesday 17 February 2004 6:11:40 am
Assuming you've created the article ok and now you're trying to 'edit' the values - The object has been created, but has not been assigned a node id yet. You need to do 4 things:
1) Validate See design/standard/content/edit_validation.tpl a simple include for this file should do the trick.
2) Edit your content
Normally you'd use attribute_edit_gui, but for this you'll probably need to do it by going through and inputing yourself like so: <input class="hidden" name="$object.contentobject_attributes.0.data_text}" value="$postvariable" /> This input will work for the title of an article because .0. tells you the position of the attribute in the array and data_text tells the input where to put the data (which variable) You may be able to put the POST variable straight into the value, but I'm not sure. You'll need to do {$object.contentobject_attributes|attribute(show)} to find out what the variable names are for other attributes of your object. It might help to have a 'dummy' data item to look at with this function, so you can see where the data needs to be entered.
3) Set the placement See standard/templates/content/edit_placement.tpl, again a simple include should suffice, but you'll want to cut some of the stuff that displays on the page out.
4) Set the MainNodeID
Copy and paste this to your input <input type="hidden" name="MainNodeID" value="{$main_node_id}" /> Hope this helps and I haven't gone backwards! Regards, James
|
Trond Åge Kvalø
|
Tuesday 17 February 2004 6:55:58 am
Thank you very much, James! I really appreciate it. I will try these steps and see if they bring me closer to a solution.
There's one thing though, when you say: "The object has been created, but has not been assigned a node id yet", you mean "hasn't been published yet", right? But I think we will need to edit published "articles" as well. (Our LMS-class will not be an article but a custom class for storing LMS-data). But it's a start and I'll dig into it right away. trondåge PS! If someone else reads this thread, I'd be happy for every contribution. trondåge
trondåge
|