Welcome Guest, Not a member yet? Register   Sign In
controller code is showing above H1 on static pages
#1

[eluser]cofmorris[/eluser]
Hi,

I'm following the tutorial. Wrestled with Godaddy's requirements to get my static pages to show -- success. Now they show with my pages.php controller code above the H1 of my home and about pages as seen here: http://cammacindustries.com/ci/index.php?/pages/view/.

Any advice on how to remedy this issue would be appreciated.

Thanks,
Chris
#2

[eluser]CroNiX[/eluser]
Does your controller have an opening php tag?
#3

[eluser]cofmorris[/eluser]
Yes. The controller is an exact "copy and paste" from the tutorial.
#4

[eluser]CroNiX[/eluser]
Try actually writing it and not copy/paste. You probably picked up some invisible character that is messing it up. This isn't a codeigniter problem. Something is making it so your server isn't interpreting the php and CI can't possibly do that.
#5

[eluser]cofmorris[/eluser]
[quote author="CroNiX" date="1361990659"]Try actually writing it and not copy/paste. You probably picked up some invisible character that is messing it up. This isn't a codeigniter problem. Something is making it so your server isn't interpreting the php and CI can't possibly do that.[/quote]

I thought it might be a syntax issue, but if it is, I'm definitely not seeing it.

Code:
<?php

class Pages extends CI_Controller {

public function view($page = 'home')
{
if ( ! file_exists('application/views/pages/'.$page.'.php'))
{
  // Whoops, we don't have a page for that!
  show_404();
}

$data['title'] = ucfirst($page); // Capitalize the first letter

$this->load->view('templates/header', $data);
$this->load->view('pages/'.$page, $data);
$this->load->view('templates/footer', $data);
}
}
#6

[eluser]ravengerpl[/eluser]
Add
Code:
?>
at the end Wink
#7

[eluser]cofmorris[/eluser]
[quote author="ravengerpl" date="1362046503"]Add
Code:
?>
at the end Wink[/quote]

Hi,
Ending the php doesn't affect the output and isn't evident in the welcome.php file which works:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Welcome extends CI_Controller {

/**
  * Index Page for this controller.
  *
  * Maps to the following URL
  *   http://example.com/index.php/welcome
  * - or -  
  *   http://example.com/index.php/welcome/index
  * - or -
  * Since this controller is set as the default controller in
  * config/routes.php, it's displayed at http://example.com/
  *
  * So any other public methods not prefixed with an underscore will
  * map to /index.php/welcome/<method_name>
  * @see http://codeigniter.com/user_guide/general/urls.html
  */
public function index()
{
  $this->load->view('welcome_message');
}
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */

I'm perplexed.
#8

[eluser]ravengerpl[/eluser]
Can you post your views files? Also add doctype to your header view (but it shouldn't cause this issue).
#9

[eluser]cofmorris[/eluser]
[quote author="ravengerpl" date="1362097528"]Can you post your views files? Also add doctype to your header view (but it shouldn't cause this issue).[/quote]

The "about" and "home" pages are simply text with no markup. The header and footer files (views/pages/templates) are exact copy&paste; from the tutorial.

SEE:
cammacindustries.com/ci/index.php?/pages/view/home
cammacindustries.com/ci/index.php?/pages/view/about

Thanks,
Chris
#10

[eluser]Otemu[/eluser]
Try a process of elimination, removing all views and starting with controller, comment out code and then test each portion eventually you will locate what is causing the issue and be able to rectify the problem.




Theme © iAndrew 2016 - Forum software by © MyBB