Welcome Guest, Not a member yet? Register   Sign In
views displaying twice after upgrading to new release
#1

[eluser]sentinel[/eluser]
Hi,

I'm having a weird issue with a project after upgrading to the 1.7.0 release from a previous version (1.6.1 I think).

The problem is that I was loading a main view that had outputted the same header / footer for each, and I would pass the view for each page via an array and echo it out via the main view.

For example, the controller for the main view would include:

Code:
function index()
        {

                $data['title'] = "Investment Bond Toolkit";    
                $data['header'] = "";
                $data['calcheader'] = "";
                $data['content'] = "";
                $this->load->vars($data);
                $this->load->view('maintemplate');      
        }


Within the other controllers the page would be rendered via something like:

Code:
$data['title'] = 'Investment Bond Toolkit';
        $data['header'] = 'Manage Saved Bonds';
        $data['content'] = $this->load->view('bonds',$input, TRUE);


        $this->load->vars($data);      
        $this->load->view('maintemplate');

Then within the main view, it would be all outputted via:

Code:
<?php  echo $content;?>

However, since upgrading and making the necessary changes, each page will be display the subview (the $content) at the top (without any dynamic data or headers and footers), then the page is rendered correctly directly beneath it, thus displaying it twice.

I'm stumped. Is there some simple change that I have overloaded that could be causing this.

I hope this makes some sense.

Rgds
Neil.
#2

[eluser]TheFuzzy0ne[/eluser]
Please could we see the view file?
#3

[eluser]xwero[/eluser]
The only reason i can think of for this to happen is that the third parameter isn't set to true every time.
#4

[eluser]TheFuzzy0ne[/eluser]
Good thinking, xwero. I second that! That would cause the content view to be output first.
#5

[eluser]sentinel[/eluser]
Thanks for the responses.

I've checked, and each controller has the third parameter set to TRUE. So that is probably not the problem.

The code for the main view is shown below (I've snipped the javascript code to make it more readable).

The line to insert the html for each page is at the bottom (all other views do not contain <html> <body> tags, etc, just divs and tables, etc.

Code:
<html>
<head>
<title><?php echo $title;?></title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
</head>
<body>
<!-- Menu bar #2. -->

<div class="menuBar">
<a class="menuButton"
    href=""
   >Start</a>
<a class="menuButton"
    href=""
   >Policyholder</a>

<a class="menuButton"
    href=""
   >Policies</a>
<a class="menuButton"
    href=""
   >Calculate</a>
<a class="menuButton"
    href=""
   >Help</a></div>

&lt;!-- Main menus. --&gt;

<div id="fileMenu" class="menu"
    >
     <a class='menuItem' href='&lt;?php echo site_url()."newcase";?&gt;'>New Calculation</a>
<a class="menuItem" href="&lt;?php echo site_url().">Load Previous Calculation</a>
<div class="menuItemSep"></div>
<a class='menuItem' href='&lt;?php echo site_url()."newenc";?&gt;'>New Encashment / Withdrawal Scenario Analysis</a>
<a class="menuItem" href="&lt;?php echo site_url().">Load Encashment / Withdrawal Scenario Analysis</a>
<div class="menuItemSep"></div>
<a class="menuItem" href="&lt;?php echo site_url().">Logout</a>
</div>

<div id="editMenu" class="menu"
    >
<a class="menuItem" href="&lt;?php echo site_url().">Add New Policyholder / Beneficiary</a>
<a class="menuItem" href="&lt;?php echo site_url().">Manage Policyholder Details</a>
</div>

<div id="policyMenu" class="menu"
    >
<a class="menuItem" href="&lt;?php echo site_url().">New Bond</a>
<a class="menuItem" href="&lt;?php echo site_url().">Manage Bonds</a>
</div>

<div id="calculateMenu" class="menu"
    >
<a class="menuItem" href="&lt;?php echo site_url().">Calculation Results</a>
<a class="menuItem" href="&lt;?php echo site_url().">Encashment Analysis Results</a>
</div>


<div id="helpMenu" class="menu"
    >
<a class="menuItem" href="&lt;?php echo site_url().">Help Manual</a>
<a class="menuItem" href="&lt;?php echo site_url().">About</a>
</div>
<br>
<div class="header">&lt;?php  echo $header;?&gt;</div>
<div class="calcheader">&lt;?php  echo $calcheader;?&gt;</div>
<div>
&lt;?php  echo $content;?&gt;
</div>
&lt;/body&gt;
&lt;/html&gt;
#6

[eluser]TheFuzzy0ne[/eluser]
I see absolutely no reason why that shouldn't work as expected, unless you're echoing the content from within the controller too.

Is it all controllers, just one controller, or just a single controller method you're having trouble with?
#7

[eluser]sentinel[/eluser]
Hi,

The problem now occurs with all the controllers/views, with the exception of the first page, which just displays the main template (all this does is display a title bar with drop down menus to lead to other pages).

This is driving me nuts.

It has to be something pretty simple. These things usually are.

Anyway, thanks for your comments / suggestions so far.

Regards
Neil.
#8

[eluser]TheFuzzy0ne[/eluser]
How have you done the upgrade? Did you completely remove the old files from the system directory, or did you just copy over the existing ones?

My suggestion would be to totally delete the system files first, and then try to install. If the problem still persists, it's most likely something to do with one of your configuration files, in which case, as painful as it may seem, I'd recommend you compare your current configuration files to the new ones, and see look for anything that might be out of place.

Obviously, it goes without saying that backups need to be made first.

If you follow the steps above, it will rule out any anomalies with the core files, and anything to do with your configuration.

If the problem still persists, then it may be time to check out any classes you may have extended (although it's unlikely there should be any problems there).

It might also be wise to create a test controller and a few very simple test views, that will mimic your current set up on a more basic scale. If the problem still persists, share it with us, and we will see if we can confirm any issues.

I'm willing to bet that your problem will most likely have something to do with incompatible configuration files of some kind.

Best of luck!
#9

[eluser]sentinel[/eluser]
Hi

When I upgraded, I copied the old model / controller / view files over, but did hand-edit the new config files.

I suspected from the start that it could be a config issue. These can be tricky to find out.

I am using third-party classes.

Therefore, I will check my config files with a toothcomb, then may and try and remove the third-party classes one at a time to see if it makes any difference.

But of an obscure one....

Neil.
#10

[eluser]TWP Marketing[/eluser]
sentinel,
I don't understand some of your code, for instance, this line:

Code:
<a class="menuItem" href="&lt;?php echo site_url().">Load Encashment / Withdrawal Scenario Analysis</a>

does not seem to have a closing php call after the site_url echo. Several lines show this same lack. It may not be related...




Theme © iAndrew 2016 - Forum software by © MyBB