[FLOW3-general] Unable to display form
Vinay Vinay
nvinayvinay at gmail.com
Thu May 6 10:45:29 CEST 2010
Hi,
In Packages/Framework/FLOW3/Classes/MVC/Controller/ActionController.php
the createAction() function is called as in the line below
call_user_func_array(array($this, $this->actionMethodName),
$preparedArguments);
There was a mismatch in the argument so I was getting error.
Hope this helps some one.
The post values is always passed as an array() to the createAction function
On Tue, May 4, 2010 at 9:30 PM, Vinay Vinay <nvinayvinay at gmail.com> wrote:
> Hi,
>
> Thanks for you early reply and clearing my doubts.
>
> Output was not comming because
>
> I created master.html (layout) and did not add the code
>
> <?xml version="1.0" encoding="utf-8"?>
> *<!DOCTYPE html
> PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">*
> *<html* lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"*>*
>
> *<head>*
> *<meta* http-equiv="Content-Type" content="text/html; charset=utf-8"* />*
>
> *<f:base />*
> *<title>*{blog.title}*</title>*
> *<link* rel="stylesheet" href="{f:uri.resource(path: 'Blog.css')}" type="text/css" media="all"* />*
>
> *</head>*
> *<body>*
> *<div* id="header"*>*
>
> *<f:if* condition="{blog}"*>*
> *<f:link.action* action="index" controller="Post" arguments="{blog: blog}"*>*
>
> *<h1* class="title"*>*{blog.title}*</h1>**</f:link.action>*
>
> *<p* class="description"*>*{blog.description}*</p>*
> *</f:if>*
>
> *</div>*
> *<div* id="maincontainer"*>*
> *<div* id="mainbox"*>**<f:render* section="mainbox"* />**</div>*
>
> *<div* class="clear"*>**</div>*
> *</div>*
>
> *<div* id="footer"*>*
> *<a* href="http://flow3.typo3.org"*>*Powered by FLOW3
>
> *<img* src="{f:uri.resource(path: 'FLOW3-Logo-11px.png')}" width="11" height="11"* />*
>
> *</a>*
> *</div>*
> *</body>*
> *</html>*
>
>
> Now I am getting the output.
>
>
> I have one more issue
>
> On getting post data
>
> 1)
>
>
> public function createAction(\F3\Blog\Domain\Model\Post $newPost) {
>
>
>
> }
>
>
> 2) /Blog/Classes/Domain/Model/blog.php has code
>
> <?php
> declare(ENCODING = 'utf-8');
> namespace F3\Blog\Domain\Model;
>
> /**
> * A blog
> *
> * @scope prototype
> * @entity
> */
> class Blog {
>
> /**
> * The blog's title.
> *
> * @var string
> */
> protected $title = '';
>
> /**
> * A short description of the blog
> *
> * @var string
> */
> protected $description = '';
>
> /**
> * The posts contained in this blog
> *
> * @var \SplObjectStorage<\F3\Blog\Domain\Model\Post>
> */
> protected $posts;
>
> /**
> * Constructs a new Blog
> *
> */
> public function __construct() {
> $this->posts = new \SplObjectStorage();
> }
>
> /**
> * Sets this blog's title
> *
> * @param string $title The blog's title
> * @return void
> */
> public function setTitle($title) {
> $this->title = $title;
> }
>
> /**
> * Returns the blog's title
> *
> * @return string The blog's title
> */
> public function getTitle() {
> return $this->title;
> }
>
> /**
> * Sets the description for the blog
> *
> * @param string $description The blog description or "tag line"
> * @return void
> */
> public function setDescription($description) {
> $this->description = $description;
> }
>
> /**
> * Returns the description
> *
> * @return string The blog description
> */
> public function getDescription() {
> return $this->description;
> }
>
> /**
> * Adds a post to this blog
> *
> * @param \F3\Blog\Domain\Model\Post $post
> * @return void
> */
> public function addPost(\F3\Blog\Domain\Model\Post $post) {
> $post->setBlog($this);
> $this->posts->attach($post);
> }
>
> /**
> * Returns all posts in this blog
> *
> * @return \SplObjectStorage<\F3\Blog\Domain\Model\Post> The posts of
> this blog
> */
> public function getPosts() {
> return clone $this->posts;
> }
>
> }
> ?>
>
>
> I am getting the error
>
> FLOW3 experienced an internal error (uncaught exception):
>
> F3\FLOW3\Error\Exception
>
>
> what is \F3\Blog\Domain\Model\Post . I have not created any class like
> this.
>
>
>
> On Tue, May 4, 2010 at 8:44 PM, Michael Sauter <mail at michaelsauter.net>wrote:
>
>> On 04.05.10 16:58, Vinay Vinay wrote:
>>
>>> Hi,
>>>
>>> I have a issue in displaying form field.
>>>
>>> After going the article from
>>>
>>> http://flow3.typo3.org/documentation/tutorials/getting-started/gettingstarted.view/
>>>
>>> 1)
>>>
>>> I created the action
>>>
>>> /**
>>> * New action
>>> *
>>> * @return void
>>> */
>>> public function newAction() {
>>> }
>>>
>>> 2)
>>>
>>> I created a html file in
>>> Blog/Resources/Private/Templates/Standard/new.html
>>>
>>
>> So you added the newAction in StandardController?
>> Make sure both controller name and template folder are the same.
>>
>>
>> and added the xml field
>>>
>>> *<f:layout* name="master"* />*
>>>
>>> *<f:section* name="mainbox"*>*
>>> *<h2* class="flow3-firstHeader"*>*Create a new post*</h2>*
>>> *<f:flashMessages* class="flashmessages"*/>*
>>> *<f:form* method="post" action="create" object="{newPost}"
>>> name="newPost" enctype="multipart/form-data"*>*
>>> *<f:form.hidden* name="blog" value="{blog}"* />*
>>> *<label* for="author"*>*Author*</label>**<br />*
>>> *<f:form.textbox* property="author" id="author"* />**<br
>>> />*
>>> *<label* for="title"*>*Title*</label>**<br />*
>>> *<f:form.textbox* property="title" id="title"* />**<br />*
>>> *<label* for="content"*>*Content*</label>**<br />*
>>> *<f:form.textarea* property="content" rows="5" cols="40"
>>> id="content"* />**<br />*
>>> *<f:if* condition="{existingPosts}"*>*
>>> *<label* for="relatedPosts"*>*Related
>>> Posts*</label>**<br />*
>>> *<f:form.select* property="relatedPosts"
>>> options="{existingPosts}"
>>> optionLabelField="title" multiple="1" size="4" id="relatedPosts"*
>>> />**<br />*
>>> *<br />*
>>> *</f:if>*
>>> *<f:form.submit* value="Submit post"*/>*
>>> *</f:form>*
>>> *</f:section>*
>>>
>>
>> As you see, the code uses some object accessors like {newPost} and {blog}.
>> Seems like they are not described in the tutorial (because the action would
>> need to assign those variables to the view). Unfortunately, the tutorial is
>> out of sync with the code base. So excpect some problems there ...
>>
>>
>> I am getting empty out put.
>>>
>>
>> What do you mean by that? Blank page? An exception?
>> Did you clear the cache?
>>
>>
>> The article says that i have to create new.html in
>>> Resources/Public/Templates/Post/
>>>
>>
>> That's obviously wrong. Should be Resources/Private/Templates/Post/.
>>
>>
>> One more thing I couldn't understand the difference between
>>> Resources/Public/
>>> and Resources/Private/
>>>
>>
>> Basically, put everything that should be accessible without FLOW3 in
>> Public, and everything else in Private.
>> So, images, css files and javascript files go in Public (because they
>> should be accessible directly), and Fluid templates and such go in Private
>> (because they shouldn't be accessible directly, but need to be parsed by the
>> template engine).
>>
>> _______________________________________________
>> FLOW3-general mailing list
>> FLOW3-general at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general
>>
>
>
More information about the FLOW3-general
mailing list