Monday, June 27, 2011

How to get something to show onscreen

Hi. I am new to cake php and am in the middle of making a blog.
Right now, I am stuck on a section. I have created two tables. One
for my posts and the other for tags for said posts. The model and
controller files are as follows:

POSTS:

-model:

<?php
class Post extends AppModel
{
var $name='Post';
var $belongsTo = array('User');
var $hasAndBelongsToMany = array('Tag');
}
?>

-controller:

<?php
class PostsController extends AppController
{
var $name = 'Posts';
var $scaffold;
}
?>


TAGS:

-model:

<?php
class Tag extends AppModel
{
var $name='Tag';
var $hasAndBelongsToMany=array('Post');
}
?>

-controller:

<?php
class TagsController extends AppController
{
var $name='Tags';
var $scaffold;
}
?>

On the blog screen for making a post, there should be a listing
showing all the tags (I currently have two already stored in the tags
table). However, for some reason I cannot possibly explain, the tags
are absent. Does anyone out there have an idea as to how to fix this?

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate