< Buzzing or vibrating the login form using jquery Posted On May 15, 2012 : 0 comments << >> Simple div slideshow using jquery Posted On May 9, 2012 : 0 comments << >> Copy mysql column in varchar to type date Posted On May 3, 2012 : 0 comments << >> Enter only numbers inside a input field of a form using javascript Posted On May 1, 2012 : 0 comments << >> Slide in and out animate div vertically using jquery Posted On April 25, 2012 : 1 comment << >> Tag cloud using php, mysql and ajax with filter Posted On April 24, 2012 : 0 comments << >> Change webpage font color or background color from the user side using javascript Posted On April 19, 2012 : 0 comments << >> A single link that cycles through several webpage background color using javascript Posted On April 17, 2012 : 0 comments << >> Simple webpage redirection using perl script Posted On April 10, 2012 : 0 comments << >> Get ipaddress using perl script Posted On April 4, 2012 : 0 comments << >>

Database Connection And Pagination In PHP Using Symfony Framework

This Tutorial Has Been Viewed 1,706 Times.
VN:F [1.9.17_1161]
Rating: 4.5/10 (2 votes cast)

After creating the project then the application and at last the module we want using symfony framework.Go to the module folder(HERE MY MODULE NAME IS PLAYLIST)

we will have the action.class.php and indexSuccess.php

First Take The Action.class.php file in dreamweaver or any editor you want and add the following codes

HERE PLAYLIST IS THE NAME OF MY MODULE

< ?php
class playlistActions extends sfActions
{
public function executeIndex(){//FTYPE is the table name//Audio Filed Name

//We are then itializing the pager to the criteria c

//We are going to display 10 results per page

$c = new Criteria();
$c->add(FilePeer::FTYPE,'AUDIO');
$c->add(FilePeer::USERID,0,Criteria::GREATER_THAN);
$this->data = FilePeer::doSelect($c);
//another criteria

$pager = new sfPropelPager('File',10);
$pager->setCriteria($c);
$pager->setPage($this->getRequestParameter('page', 1));

$pager->init();
$this->pager = $pager;

}
}

?>

Now we are going to use the success page of the action page indexSuccess.php

 <body bgcolor="#000000?>
< ?php use_helper('Javascript') ?><table border="1?>
< ?php $i=($pager->getPage()*10)-10+1; ?>
< ?php foreach ($pager->getResults() as $user): ?>< ?php // echo $dat->getId();

$image = $user->getUserid();

$author = $user->getCaption();
$date =$user->getDate();
$mainid =$user->getId();

?>
< ?php
//echo link_to(image_tag('http://s3.amazonaws.com/mobusers/100×100/'.$image), 'article/read?title=Finance_in_France') ?>

<td align=left><tr align=left>
<td width='1%'><input type='checkbox' name='mob$balu' id='box' value='$mainid' /><img alt='Select This Song' width=90 src='http://s3.amazonaws.com/tutorialz/100×100/<?php echo $image;?/>' ></td>
<td>
<b> <font color=#000000>< ?php echo $author;?></font></b>
<div class='desc'><i>Page: < ?php echo $image?></i></div>
<span class='postdetails'>Date Added:< ?php echo $date;?><br /><a href='javascript:void(0)' onClick="window.open('http://audio.balu.in/audio/player.php?id=<?php echo $mainid ;?>','mobplayer','height=226, width=555,toolbar=no,scrollbars=no,menubar=no,location=no,status=0,resizable=0,left=400,top=400' )">

< ?php echo image_tag('play.jpg');?> </a></span>

</td></tr></td></table>

<table border="1">

< ?php $i=$i+1; ?>
< ?php endforeach ?>

< ?php if ($pager->haveToPaginate()): ?>
</table><table width="61%" border="0? cellpadding="0? cellspacing="0?>
<tr>
<td width="10%" height="24? align="center" valign="middle" class="formText"><a href="<?php echo url_for('playlist/index?page='.$pager->getFirstPage()); ?>" class="Heading6?>FIRST</a></td>
<td width="8%" height="24? align="center" class="formText"><strong><a href="<?php echo url_for('playlist/index?page='.$pager->getPreviousPage()); ?>" class="Heading6?>< </a></a></strong></td>

< ?php $links = $pager->getLinks(); foreach ($links as $page): ?>
<td width="9%" align="center" valign="middle" class="formText">< ?php echo ($page == $pager->getPage()) ? $page : link_to($page, 'playlist/index?page='.$page) ?>
</td>
< ?php endforeach ?>

<td width="13%" height="24? align="center" valign="middle" class="formText"><a href="<?php echo url_for('playlist/index?page='.$pager->getNextPage()); ?>">></a></td>
<td width="18%" height="24? align="center" valign="middle" class="formText"><a href="<?php echo url_for('playlist/index?page='.$pager->getLastPage()); ?>" class="Heading6?>LAST</a></td>
</tr>
</table>
< ?php endif ?>


VN:F [1.9.17_1161]
Rating: 4.5/10 (2 votes cast)

Database Connection And Pagination In PHP Using Symfony Framework, 4.5 out of 10 based on 2 ratings

Incoming search terms:





You will also be interested in ,

Leave a Reply

Proudly designed by Mistonline.in.
Affordable Seo PackagesSeo BlogEdu Backlinks