Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4587948
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T21:51:11+00:00 2026-05-21T21:51:11+00:00

This my link in newsses/index.ctp $this->Html->link(__(Read more >>, TRUE), array(‘action’=>’view’, $newss[‘Newsse’][‘title’])); and this my

  • 0

This my link in newsses/index.ctp

$this->Html->link(__("Read more >>", TRUE), array('action'=>'view', $newss['Newsse']['title']));

and this my view code in newsses_controller.php:

function view($title = NULL){
    $this->set('title_for_layout', __('News & Event', true));

    if (!$id) {
        $this->Session->setFlash(__('Invalid News.', true), 'default', array('class' => 'error')); 
        $this->redirect(array('action'=>'index'));
    }
    $this->set('newsse', $this->Newsse->read(NULL,$title));
    $this->set('newsses', $this->Newsse->find('all'));
}

but it does’t showing anything,
i want to make route like:
“newsses/view/2” to “newsses/view/title_of_news”

please help me….

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T21:51:13+00:00Added an answer on May 21, 2026 at 9:51 pm

    You’re using the Model::read() method method which takes as the second argument the id of the row in your Model’s table that you want to access. It’s better to use find in this case. You don’t need to build a new method in your model or your controller, you can just edit the current view method.

    # in newsses_controller.php:
     function view($title = null) {
         $this->set('title_for_layout', __('News & Event', true));
    
         if (!$id) {
            $this->Session->setFlash(__('Invalid News.', true), 'default', array('class' => 'error')); 
            $this->redirect(array('action'=>'index'));
        }
    
        $this->set('newsse', $this->Newsse->find('first', array(
            'conditions' => array('Newsse.title' => $title)
        ));
        $this->set('newsses', $this->Newsse->find('all'));
    }
    

    Or, you can make a more hybrid form in which viewing by id is still possible when a numerical title is given (this assumes you never have news items which have a title consisting of only numeric characters, e.g. ‘12345’).

    # in newsses_controller.php:
     function view($title = null) {
         $this->set('title_for_layout', __('News & Event', true));
    
         if (!$id) {
            $this->Session->setFlash(__('Invalid News.', true), 'default', array('class' => 'error')); 
            $this->redirect(array('action'=>'index'));
        } else if (is_numeric($title)) {
            $this->set('newsse', $this->Newsse->read(NULL, $title));
        } else {
            $this->set('newsse', $this->Newsse->find('first', array(
                'conditions' => array('Newsse.title' => $title)
            ));
        }
    
        $this->set('newsses', $this->Newsse->find('all'));
    }
    

    Finally, you can also replace the find method in my example with a (shorter) custom findBy method (see the documentation for more info about this).

    $this->Newsse->findByTitle($title);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Try this link on Firefox or Chrome: http://dl.dropbox.com/u/34375299/aaa/index.html Notice a simple animation appears on
This link http://ajaxcontroltoolkit.codeplex.com/releases/view/11121#DownloadId=28808 shows a popup on which one has to agree before being
following this link i was able to load and read pixels from a .gif.
This link describes my problem exactly: http://old.nabble.com/Android-database-corruption-td28044218.html#a28044218 There are about 300 people using my
Using XPath to parse this link $html = '<a href=/browse/product.do?cid=1&amp;vid=1&amp;pid=1 class=productItemName>what is going on
Given this link within the FancyBox framework: <a class=fancyBox href=http://localhost/ccms/index.cfm?do=user.update id=userLink>Update</a> If I click
this link works great with chrome and firefox 4 http://cluster005.ovh.net/~bquadint/drmonod/ However, if i view
This link: http://doc.trolltech.com/4.5/moc.html#moc says The moc tool reads a C++ header file. If it
From this link: http://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html If a standard system include directory, or a directory specified
at this link: http://jqueryui.com/demos/tabs/ when we look view source, we have: <div id=tabs> <ul>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.