Welcome Guest, Not a member yet? Register   Sign In
[solved] Why is the Pagination class adding a doctype to my page?
#1

[eluser]jzbruno[/eluser]
Hello,

I am new to Codeigniter and so far I am really enjoying it. I have ran into a problem though. When I load the pagination class it adds the following html to the top of my page.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html &gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;/body&gt;
&lt;/html&gt;

I have narrowed it down to putting nothing but the following in the controller and getting the above html.

Code:
function index() {
    $this->load->library('pagination');
}

Is this normal behavior? If so is there a way around it? Thanks.
#2

[eluser]maria clara[/eluser]
you can check the user_guide here: Pagination Class

or you can look at this thread for reference:

http://ellislab.com/forums/viewthread/143280/

cheers,
kahtrina Wink
#3

[eluser]jzbruno[/eluser]
Thanks for the reply. I read through the links you posted and am not seeing an answer.

Just to clarify. I am not asking how pagination works, I have it working perfectly. I am also not asking how to add the html. I am asking WHY is the pagination class adding that html when I load the library?
#4

[eluser]jzbruno[/eluser]
Can someone try this for me and see if they get the same result? Just create a controller and load the pagination library. Thanks.
#5

[eluser]John_Betong[/eluser]
[quote author="jzbruno" date="1265966631"]Can someone try this for me and see if they get the same result? Just create a controller and load the pagination library. Thanks.[/quote]

I tried it and did not encounter any problems.

Can you:

1. expand your index(...) function
2. create a "pagination_test_view.php" view file
3. call $this->load->view('pagination_test_view');
4. show us the results.

I am using the the latest CodeIgniter SVN Version: 1811

&nbsp;
&nbsp;
&nbsp;
#6

[eluser]jzbruno[/eluser]
Thanks for giving it a try. This is very weird, I even started digging through the CodeIgniter source with no luck. I created the following controller.

Code:
&lt;?php

class PaginationTest extends Controller {

    function index() {
        
        $this->load->library('pagination');
        $this->load->view('pagination_test_view');
    }
}

And this view.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
&lt;html &gt;
&lt;head&gt;
    &lt;title&gt;Pagination Test&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
    <h1>Pagination Test</h1>
&lt;/body&gt;
&lt;/html&gt;

With this output (viewing source in Firefox).

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html &gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;/body&gt;
&lt;/html&gt;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
&lt;html &gt;
&lt;head&gt;
    &lt;title&gt;Pagination Test&lt;/title&gt;

&lt;/head&gt;

&lt;body&gt;
    <h1>Pagination Test</h1>
&lt;/body&gt;
&lt;/html&gt;

I am using CodeIgniter 1.7.2 from the site download.
#7

[eluser]jzbruno[/eluser]
I figured it out. At one point I was going to put the pagination $config in pagination.php in the config folder. I created the file with Dreamweaver which gives you a default html page but only saved it and didn't actually put the config in there.

Sorry for the trouble.
#8

[eluser]John_Betong[/eluser]
[quote author="jzbruno" date="1265975607"]I figured it out. At one point I was going to put the pagination $config in pagination.php in the config folder. I created the file with Dreamweaver which gives you a default html page but only saved it and didn't actually put the config in there.

Sorry for the trouble.[/quote]

I am pleased you managed to solve your problem and especially in providing the solution.

&nbsp;
&nbsp;




Theme © iAndrew 2016 - Forum software by © MyBB