Question

I'm writing web project which consists of layout page with different types of reports. I'm using tooltip ui so customers can read the description of each report when they hover it, which consist of 6-8 sentences. All report's names are stored in one table reports as column 'report name' with column 'description'. Each report is a function in my structure. Is it a right way to keep separate description of report from Report's data? Is there are any good practices that I should be aware of? Here is my code:

In Controller:

function my_report_name() 
    {
        $data['report_name']=$this->Reports_model->getMyReportNameSummary();
        $data['description_report_name']=$this->Reports_model->getReportDescription('my_report_name');

        //view in 'view/report' folder to use
        //name of view always the same as name of function
        $data['main'] = "report/my_report_name";

        $this->load->vars($data);
        //load template
        $this->load->view('template/t_main_full', $data);
    }

In layout page:

 <tr>
 <a title="$description_report_name" href="<?= site_url('/reports/my_report_name') ?>">My Report Name</a> 
</tr>
Was it helpful?

Solution

What does the Reports_model method getReportDescription() accept as a parameter? You are sending 'my_report_name' which doesn't look correct to me.

$data['description_report_name']=$this->Reports_model->getReportDescription(my_report_name);

Anyway, checking what

Reports_model->getReportDescription()

returns would be a good first step.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top