Hi cricket, Thank You for your reply,

speaking of "unique usernames"... in fact yes, they are all unique.
i'm not quite understud what Amit meant to be,... yes they are all
unique, and each user has its own Videos, Groups, Blogs, Profile,
Business Profile, etc... and in order to favorite let say I (user1)
want to favorite video that you (user2) have post it in from youtube
or google and have favorite section so I can access with no time. the
clear picture of this,... if its not to much trouble could you please
access http://www.zippopeople.com and please signup to see your
favorite section in My Videos, My Groups, ... this is just a testing
URL and all records will be deleted after all... here is my ../views/
videos/favorites.ctp file, and in order to link to that ORIGINAL VIDEO
that have been posted from your favorites you need to have a some
unique string (i name it $parent['User']['username']) other from
($user_obj['User']['username']) where in my case "user_obj" is the
User1 and "parent" is User2. and I have to link it to ORIGINAL video
show page. here is my favorites.ctp file


        <div style="float: left; margin: 1px 5px 0 0; width: 650px;">


        <div style="float: left; margin: 1px 5px 0 0; width: 650px;">

<div class="buddy" style="float: left; display: block; margin: 0 10px
0 0;">
  <?php echo $html->link($photoShow->buddy($user_obj, array('height'
=> 36, 'width' => 36)), '/profile/' . $user_obj['User']['username'],
false, false, false) ?>

</div>


  <div style="float: left; display: block;  width: 250px;">

  <span style="float: left; font-size: 13px; font-weight: normal;
margin-top: 1px;">
  <?php echo ucfirst(Inflector::pluralize(__('video', true))) ?>: <?
php echo $html->link($user_obj['User']['firstname'] . ' ' .
$user_obj['User']['lastname'], '/profile/' . $user_obj['User']
['username'], array('style' => 'color: #000000;')) ?>
</span>
          <div class="clr"></div>


  <span style="float: left; font-size: 12px; font-weight: normal;
margin-top: 2px;">

<?php if($user_obj['User']['online_status']==0): ?>
   <?php echo __('status', true) ?>: <strong><span style="color:
red;"><?php echo ucfirst(__('offline now', true)) ?></span></strong>
   <?php else: ?>
   <?php echo __('status', true) ?>: <strong><span style="color:
#0EC107;"><?php echo ucfirst(__('online now', true)) ?></span></
strong>
   <?php endif ?>
</span>

  </div>





 <div style="float: right; margin: 0 5px 0 0; font-size: 12px; font-
weight: normal; text-align: right;">

     <span style="float: right; font-size: 12px; font-weight: bold;
text-align: right; margin: 0 0 5px 0;">

    <?php echo $html->link(ucfirst(__('ALL VIDEOS', true)), '/
videos' , array('style' => 'color: #000000;')) ?>
     </span>

    <div class="clr"></div>
     <span style="float: right; font-size: 14px; font-weight: normal;
text-align: right; margin: 0 0 5px 0;">
 <?php if($user->is_authorized($user_obj['User']['id'])): ?>
<?php echo $html->link(ucfirst(__('my favorites', true)) . ' - ' .
$user_obj['User']['video_favorites'], '/videos/favorites/' .
$user_obj['User']['username']) ?>
  |      <?php endif ?>

  <?php echo $html->link(ucfirst(Inflector::pluralize(__('video',
true))) . ' ' . $user_obj['User']['firstname'] . ' ' .
$user_obj['User']['lastname'] . ' - ' . $user_obj['User']['videos'], '/
videos/index/' . $user_obj['User']['username']) ?>

    </span>
 </div>


<div class="clr"></div>


        <div style="float: left; display: block; font-size: 13px; font-
weight: normal; margin: 10px 0 10px 46px; position: relative;">

        <span class="sort"><?php echo ucfirst(__('sort by', true)) ?></
span>:


    <?php echo $paginator->sort(__('added date', true), 'created',
array('model' => 'VideoFavorite', 'escape' => false, 'url' =>
am($url_options, array('direction' => 'desc', 'page' => 1)), 'class'
=> $application->paginator_order() == 'created' ? 'selected' : '')) ?>
     -
    <?php echo $paginator->sort(__('alphabetically', true), 'name',
array('model' => 'VideoFavorite', 'direction' => 'desc', 'escape' =>
false, 'url' => am($url_options, array('direction' => 'asc', 'page' =>
1)), 'class' => $application->paginator_order() == 'name' ?
'selected' : '')) ?>
             

      <?php echo $html->link(ucfirst(__('videos', true)) . ' - ' .
$this->params['paging']['VideoFavorite']['count'], '/videos/index/' .
$user_obj['User']['username'], array('class' => 'photos')) ?>
       

      <?php if(array_key_exists('date', $this->params['pass'])): ?>
      <?php echo $html->link(ucfirst(__('added date', true)) . ' : ' .
$application->daysAgo($time, strftime('%Y-%m-%d', strtotime($this-
>params['pass']['date']))), '/videos/favorites/' . $user_obj['User']
['username'] . '/date:' . $this->params['pass']['date'], array('class'
=> 'calendar')) ?>
      <?php else: ?>
      <?php echo $html->link(ucfirst(__('added date', true)) . ' : ' .
__('all', true), '/videos/favorites/' . $user_obj['User']['username'],
array('class' => 'calendar')) ?>
      <?php endif ?>

      <img style="float: none;" src="<?php echo $this->webroot ?>img/
arrow.png" width="18" height="15" align="top" class="arrow"
onClick="javascript:showMenu('id_menu_date')"
onmouseup="javascript:swapImage(1, this)"
onmouseover="javascript:swapImage(0, this)"
onmouseout="javascript:swapImage(2, this)">

      <div class="sub_menu" id="id_menu_date">
        <?php echo $html->link(__('all', true) . ' - ' .
$videos_count, '/videos/index/' . $user_obj['User']['username']) ?>
        <?php foreach($dates as $date): ?>
        <?php echo $html->link($application->daysAgo($time,
current(current($date))) . ' - ' . $date[0]['videos'], $paginator-
>url(am($url_options, array('date' => $time->format('j.n.Y',
current(current($date))))), true)) ?>
 <?php endforeach ?>
      </div>
<div class="clr"></div>
        </div>


<div class="clr"></div>
<br />

 <?php if($user->is_authorized($user_obj['User']['id'])): ?>
  <span style="text-align: left; font-size: 12px; font-weight:
normal;">
<span style="float: right; margin: 0 40px 0 0;">
   <?php echo $html->link(ucfirst(__('upload Videos', true)), '/
videoupload', array('class' => 'photos'), false, false, false) ?>
    |    
 <?php echo $html->link(ucfirst(__('manage Videos', true)), '/videos/
manage/' . $user_obj['User']['id'], array('class' => 'edit'), false,
false) ?>
</span>
  </span>
    <?php endif ?>
<div class="clr"></div>


                        <div  style="float: left; margin: 10px 5px 0 5px; 
padding: 0 3px 0
3px; width: 625px;">
<?php $i = 0; ?>
<?php foreach($videos as $video): ?>


  <div style="float: left; width: 625px; padding: 0 3px 7px 3px;"
class="comment notlast">

        <div style="float: left; border: 1px solid #aaa; padding: 5px;">

        <? if(empty($video['Video']['video_thumb'])): ?>
<?php echo $html->link($html->image("myplay.jpg", array('height' =>
84, 'width' => 120)),'/videos/show/'.$user_obj['User']['username'].'/'.
$video['Video']['id'],array('escape'=>false))?>

<? else: ?>
<?php echo $html->link($html->image($video['Video']['video_thumb'],
array('height' => 84, 'width' => 120)),'/videos/show/'.
$user_obj['User']['username'].'/'.$video['Video']
['id'],array('escape'=>false))?>
<? endif ?>


        </div>


        <div style="float: left; margin: 0 0 0 13px; display: block; width:
470px;">

        <span style="float: left; font-size: 1.1em; color: #0B1033; font-
weight: normal; margin-top: 0;">
        <?php echo ucfirst(__('title', true)) ?>: 
        <strong><?php echo $application->cut($video['Video']['name'], 60) ?></
strong>
        </span>

        <div class="clr"></div>

        <span style="float: left; font-size: 1.4em; font-weight: normal;">
        <?php echo ucfirst(__('description', true)) ?>: 
        <?php echo $application->cut($video['Video']['description'], 100) ?></
span>

        <div class="clr"></div>


  <span style="float: left; font-size: 1.1em; font-weight: normal;
color: #aaa; margin-top: 5px;">

        <?php echo ucfirst(__('category', true)) ?>: 
        <?php echo $html->link($video['VideoCategory']['name'], '/videos/' .
$video['VideoCategory']['name']) ?>
    
         <?php echo ucfirst(__('by', true)) ?>: 
        <?php echo $html->link($parent['User']['username'], '/profile/' .
$parent['User']['username']) ?></span>

<div class="clr"></div>


        <span style="float: left; font-size: 1em; font-weight: normal;
color: #000000; margin-top: 13px;">
        <?php echo ucfirst(__('views', true)) ?>: 
        <?php echo $video['Video']['views'] ?>
   |   
        <?php echo $html->link(ucfirst(Inflector::pluralize(__('comment',
true))) . ' - ' . $video['Video']['comments'], '/videos/show/' .
$user_obj['User']['username'] . '/' . $video['Video']['id']) ?>
        </span>


   <span class="notimportant date" style="float: right; margin-top:
15px;">
<?php echo $application->timeAgo($time, $video['Video']['created']) ?>
</span>

   <div class="clr"></div>

   </div>
        </div>


  <?php if($i++ % 1 - 0 == 0): ?>
  <div class="clr"></div>
  <?php endif ?>
 <?php endforeach ?>
  <div class="clr"></div>
  </div>





  <div class="clr"></div>

        <!-- <span style="float: left; display: block; font-size: 11px; font-
weight: normal; margin: 20px;">
 <?php echo $html->link(ucfirst(__('what\'s This ?', true)), '/
videos') ?>
        </span> -->
                </div>
        </div>
        <div style="width: 250px; float: left; margin: 1px 0 0 5px; padding-
left: 15px; border-left: 1px solid #aaa;">

   <h3 class="styled" style="width: 240px;"><?php echo
ucfirst(__('highlights', true)) ?></h3>
  <div class="clr"></div>
  <p style="float: right; font-size: 11px; font-weight: normal;
margin: 0 5px 8px 0; letter-spacing: 3px; color: #2DD1F9;"><?php echo
__('advertising', true) ?></p>
  <div class="clr"></div>
<div style="float: left; margin: 0 0 0 5px;">
<!-- <?php echo $this->renderElement('../pages/ad') ?> -->
<br /><br />
<?php echo $this->renderElement('../pages/ad2') ?>
<br /><br />
        </div>
 </div>
<div class="clr"></div>
<br /><br />
<div class="clr"></div>
<?php echo $this->renderElement('paginator') ?>
<div class="clr"></div>

THANKS
Chris


On Dec 23, 10:34 am, cricket <zijn.digi...@gmail.com> wrote:
> On Wed, Dec 22, 2010 at 8:56 PM, chris...@yahoo.com <chris...@yahoo.com> 
> wrote:
>
> > no there is no unique username, this is a social network site with
> > lots of users ;) I guess,... this still in construction...
>
> If username is not unique your favorites action will never work
> properly as it's only param is $username. You'll either need to ensure
> that usernames are unique across your DB or use something else with
> which to get a particular user's favorites.
>
> I haven't gone through all of your code (frankly, it looks like it
> would benefit from a careful re-write, especially moving quite a lot
> of it to a model) but, in order to use model::field() you first must
> set the model's id. The point of field() is to get the column value
> for a particular row. If the model's id is not set, you can't query
> that row.
>
> I think $parent_id isn't a good choice for variable name here, as
> you're not dealing with the parent Video of another Video. I assume
> that it's the User that created the Video, but I'm unsure.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to