Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8
|
BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8
This is the forum to discuss the Wrox book Professional CodeIgniter by Thomas Myer; ISBN: 9780470282458
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 2nd, 2009, 11:01 PM
Registered User
 
Join Date: May 2009
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error in sample code "Professional Codeigniter"

Hai everyone!

I have lots of question about u'r book Thomas. Despite lot's of error inside of it, i have to say this is a really nice book.

I have a couple of question if you don't mind Thomas.

1. I can't click any link from the shopping sample code, until I change the config.php, and the value $config['index_page'] = ""; and use the index.php inside it. Why this happen?

2. Cannot login into the dasbord. I manage to login, after I change the autoload helper autoload.php and remove security in it. $autoload['helper'] = array('url','form','text','date',''); and remove this entry from models madmins.php
Quote:
//$this->db->where('username',db_clean($u,16));
//$this->db->where('password', db_clean(dohash($pw),16));
Can you explain to me?

3. In the admin pages home, on the Full Path collumn i keep getting error "
A PHP Error was encountered

Quote:
Severity: Notice

Message: Undefined index: category_id

Filename: views/admin_pages_home.php

Line Number: 22
i really stuck in this, can you give a hand? I have attach the view (admin_pages_home.php), controller (pages.php) and models (mcats.php).

Sory for my bad english. English not my primary language :)
Thanks before i really need u'r help.

--
Trims,
Bob
 
Old June 3rd, 2009, 07:45 AM
Wrox Author
 
Join Date: May 2008
Posts: 53
Thanks: 0
Thanked 5 Times in 5 Posts
Default I'm going to work this offline for a bit

Hi guys, I'm working with langithitam via email as I suspect I'll need to dig through his config and setup. When I get it all straightened out, I'll post here.
__________________
Thomas Myer
Author, Professional CodeIgniter
http://www.tripledogs.com
 
Old June 3rd, 2009, 08:05 AM
Wrox Author
 
Join Date: May 2008
Posts: 53
Thanks: 0
Thanked 5 Times in 5 Posts
Default Part of the mystery solved

For #3, please use code on page 243. I think I sent the publisher the wrong file for admin_pages_home.php, so the ZIP is incorrect. Not sure how that happened. Will remediate as soon as I can.
__________________
Thomas Myer
Author, Professional CodeIgniter
http://www.tripledogs.com
 
Old June 3rd, 2009, 08:18 AM
Registered User
 
Join Date: May 2009
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

mysteri no#3 solved, the error is in the source code. I should use the script from the book.. thanks to myer

PHP Code:
<h1><?php echo $title;?> </h1> 
<p><?php echo anchor("admin/pages/create""Create new page");?> </p> 
<?php
if ($this-> session-> flashdata('message')){
  echo 
"<div class='message'> ".$this-> session-> flashdata('message')."</div> ";
}
           
if (
count($pages)){
  echo 
"<table border='1' cellspacing='0' cellpadding='3' width='400'> \n";
  echo 
"<tr valign='top'> \n";
  echo 
"<th> ID</th> \n<th> Name</th> <th> Status</th> <th> Actions</th> \n";
  echo 
"</tr> \n";
  foreach (
$pages as $key =>  $list){
    echo 
"<tr valign='top'> \n";
    echo 
" <td> ".$list['id']."</td> \n";
    echo 
"<td> ".$list['name']."</td> \n";
    echo 
"<td align='center'> ".$list['status']."</td> \n";
    echo 
"<td align='center'> ";
    echo 
anchor('admin/pages/edit/'.$list['id'],'edit');
    echo 
" | ";
    echo 
anchor('admin/pages/delete/'.$list['id'],'delete');
    echo 
"</td> \n";
    echo 
"</tr> \n";
  }
  echo 
"</table> ";
}
?>

Last edited by langithitam; June 3rd, 2009 at 09:30 PM..
 
Old June 3rd, 2009, 08:07 PM
Wrox Author
 
Join Date: May 2008
Posts: 53
Thanks: 0
Thanked 5 Times in 5 Posts
Default Corrected code for admin_pages_home.php view

PHP Code:
<h1><?php echo $title;?></h1>
<p><?php echo anchor("admin/pages/create""Create new page");?></p>
<?php
if ($this->session->flashdata('message')){
    echo 
"<div class='message'>".$this->session->flashdata('message')."</div>";
}

if (
count($pages)){
    echo 
"<table border='1' cellspacing='0' cellpadding='3' width='400'>\n";
    echo 
"<tr valign='top'>\n";
    echo 
"<th>ID</th>\n<th>Name</th><th>Status</th><th>Actions</th>\n";
    echo 
"</tr>\n";
    foreach (
$pages as $key => $list){
        echo 
"<tr valign='top'>\n";
        echo 
"<td>".$list['id']."</td>\n";
        echo 
"<td>".$list['name']."</td>\n";
        echo 
"<td align='center'>".$list['status']."</td>\n";
        echo 
"<td align='center'>";
        echo 
anchor('admin/pages/edit/'.$list['id'],'edit');
        echo 
" | ";
        echo 
anchor('admin/pages/delete/'.$list['id'],'delete');
        echo 
"</td>\n";
        echo 
"</tr>\n";
    }
    echo 
"</table>";
}
?>
__________________
Thomas Myer
Author, Professional CodeIgniter
http://www.tripledogs.com
 
Old November 1st, 2009, 06:20 AM
Authorized User
 
Join Date: Nov 2009
Posts: 26
Thanks: 3
Thanked 0 Times in 0 Posts
Default Answer for #2 and 3

For login, the original code hash the pw using SHA1 and use the first 16 letters.
So I suggest you put back the code as original.
Then go to http://www.whatsmyip.org/hash_generator/, and copy and paste the first 16letters of SHA1 into password for admin in admins table in your database.

Then try it again.

Regarding #3.
The following is the code for admin_page_home.php I use to show the path.

Code:
<h1><?php echo $title;?></h1>
<p><?php echo anchor("admin/pages/create", "Create new page");?></p>
<?php
if ($this->session->flashdata('message')){
	echo "<div class='message'>".$this->session->flashdata('message')."</div>";
}

if (count($pages)){
	echo "<table border='1' cellspacing='0' cellpadding='3' width='600'>\n";
	echo "<tr valign='top'>\n";
	echo "<th>ID</th>\n<th>Name</th><th>Full Path</th><th>Status</th><th>Actions</th>\n";
	echo "</tr>\n";
	foreach ($pages as $key => $list){
		echo "<tr valign='top'>\n";
		echo "<td>".$list['id']."</td>\n";
		echo "<td>".$list['name']."</td>\n";
		echo "<td>";
   		if (!preg_match("/\.html$/",$list['path'])){
  			$list['path'] .= ".html";
  		}		
		
		if ($list['category_id'] == 0){
			echo "/". $list['path'];
		}else{
			echo "/". $cats[$list['category_id']]. "/". $list['path'];
		}
		echo "</td>";
		echo "<td align='center'>".$list['status']."</td>\n";
		echo "<td align='center'>";
		echo anchor('admin/pages/edit/'.$list['id'],'edit');
		echo " | ";
		echo anchor('admin/pages/delete/'.$list['id'],'delete');
		echo "</td>\n";
		echo "</tr>\n";
	}
	echo "</table>";
}
?>





Similar Threads
Thread Thread Starter Forum Replies Last Post
Code for "A C# Application from Inspiration to Implementation" sonhoang All Other Wrox Books 4 September 27th, 2010 04:56 AM
Chapter 2 "An attempt to attach an auto-named database for file.." Gredkins BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio 4 May 28th, 2009 11:55 PM
Code not going as planned: "icicle" vs "savedinstancestate" joopthecat BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 3 May 3rd, 2009 03:09 PM
How to download Code in "Professional Active Server Page 3.0 " book. renjith0 All Other Wrox Books 2 April 2nd, 2009 05:06 AM
Downloaded code: "20-4" missing Rachel BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 1 February 16th, 2009 06:00 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.