CodeIgniter Forums
Session is not holding the data When I use wordpress - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Session is not holding the data When I use wordpress (/showthread.php?tid=54984)



Session is not holding the data When I use wordpress - El Forum - 10-04-2012

[eluser]Unknown[/eluser]
Hi all,

I have two applications 1. CodeIgniter 2.Wordpress

What I want is if I run http://www.mydomain.com/ci/controller/ It has to Fetch the wordpress Search template(mytheme/search.php) along with my CI Session Data.


For this What I did was

1. In index.php I included wordpress/wp-load.php
Code:
require_once(APPPATH."../../wordpress/wp-load.php");
require_once BASEPATH.'core/CodeIgniter.php';


2. In View File of my controller I copied the Wordpress Search page

Code:
<?php
/**
* The template for displaying Search Results pages.
*
* @package WordPress
* @subpackage Twenty_Eleven
* @since Twenty Eleven 1.0
*/


get_header(); ?>

  <section id="primary">
   <div id="content" role="main">

   &lt;?php if ( have_posts() ) : ?&gt;

    &lt;header class="page-header"&gt;
     <h1 class="page-title">&lt;?php printf( __( 'Search Results for: %s', 'twentyeleven' ), '<span>' . get_search_query() . '</span>' ); ?&gt;</h1>
    &lt;/header&gt;

    &lt;?php twentyeleven_content_nav( 'nav-above' ); ?&gt;

    &lt;?php /* Start the Loop */ ?&gt;
    &lt;?php while ( have_posts() ) : the_post(); ?&gt;

     &lt;?php
      /* Include the Post-Format-specific template for the content.
       * If you want to overload this in a child theme then include a file
       * called content-___.php (where ___ is the Post Format name) and that will be used instead.
       */
      get_template_part( 'content', get_post_format() );
     ?&gt;

    &lt;?php endwhile; ?&gt;

    &lt;?php twentyeleven_content_nav( 'nav-below' ); ?&gt;

   &lt;?php else : ?&gt;

    <article id="post-0" class="post no-results not-found">
     &lt;header class="entry-header"&gt;
      <h1 class="entry-title">&lt;?php _e( 'Nothing Found', 'twentyeleven' ); ?&gt;</h1>
     &lt;/header&gt;&lt;!-- .entry-header --&gt;

     <div class="entry-content">
      <p>&lt;?php _e( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.', 'twentyeleven' ); ?&gt;</p>
      &lt;?php get_search_form(); ?&gt;
     </div>&lt;!-- .entry-content --&gt;
    </article>&lt;!-- #post-0 --&gt;

   &lt;?php endif; ?&gt;

   </div>&lt;!-- #content --&gt;
  </section>&lt;!-- #primary --&gt;

&lt;?php get_sidebar(); ?&gt;
&lt;?php get_footer(); ?&gt;


I could see the result page rendering nicely, BUT Here is my Problem

The Session Data What Ever I am setting is vanishing at this point.
Every Page Refresh I am seeing a New Session ID.

All My CI Session data is lost.

How can I Hold the CI session data.

Please Help.