this on ask.cakephp.org @ stackoverflow:
http://stackoverflow.com/questions/8877842/how-to-count-the-number-of-user-downloads/
with probably the answer you are looking for
On 18 Jan., 15:37, ahmed fakher <spcial...@gmail.com> wrote:
> i want to know how to count when someone click to download some
> file..please i need one example with answer ..cause i mam newbie
>
> important notice
> .. i don't store my files in database..i store it into webroot/files
> and i use meioupload to upload files
> i see this tut but i don't understand how to use it
>
> CREATE TABLE IF NOT EXISTS `downloads` (
> `id` int(11) NOT NULL AUTO_INCREMENT,
> `filename` varchar(50) NOT NULL,
> `title` varchar(70) NOT NULL,
> `type` varchar(150) NOT NULL,
> `filesize` int(11) unsigned NOT NULL,
> `counts` int(11) NOT NULL,
> `created` datetime NOT NULL,
> PRIMARY KEY (`id`)
> ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=21 ;
>
> {{{
>
> downloads_controller.php
>
> <?php
> class DownloadsController extends AppController {
> var $helpers = array ( "Html", "Ajax", "Javascript" ,"Number");
> var $name = 'Downloads';
> var $paginate = array('limit' => 3, 'page' => 1, 'order' =>
> array('Download.id'=>'desc'));
>
> function index() {
> $this->set('downloads', $this->paginate());
> }}
>
> ?>
>
> downloads/index.ctp
>
> <?php
> $i = 0;
> foreach ($downloads as $download):
> $class = null;
> if ($i++ % 2 == 0) {
> $class = ' class="altrow"';
> }
> ?>
> <tr<?php echo $class;?>>
> <td>
>
> <?php
> $title = $download['Download']['title'];
> $filename = '/files/'.$download['Download']['filename'];
> echo $this->Html->link($title, $filename,array('escape' => false));
>
> ?>
>
> </td>
--
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
No comments:
Post a Comment