Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8378393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:55:06+00:00 2026-06-09T15:55:06+00:00

I’am using a codeigniter 2.x. What i need is to insert a values into

  • 0

I’am using a codeigniter 2.x. What i need is to insert a values into an array of config/template.php from inside of a view file /views/home.php.

I’ve created a custom config file application/config/template.php:

$config['site_name'] = "Sitename";
$config['site_lang'] = "En-en";
$config['page_name'] = "Pagename";
$config['css_page'] = "default";
$config['alias'] = "";

$config['head_meta'] = array(
    'description' => 'description',
    'keywords' => 'meta, keywords',
    'stylesheets' => array(
        'template.css'
    ),
    'scripts' => array(
        'jquery.js',
        'template.js'
    ),
    'charset' => 'UTF-8'
);
$config['sidebars'] = array();

Then, i use application/views/template/template.php as my main HTML layout, where at the beginning I include a file application/views/template/includes/inc-tpl-cfg.php which globalize my configurations for a template into an one file with arrays, so i could access them a little bit easier. Here is the content of that inc-tpl-cfg.php:

<?php

// No direct acces to this file
if (!defined('BASEPATH')) exit('No direct script access allowed');

/* Template configuration needs to be defined to make them accessible in the whole template */
$cfg_template = array(
    'sitename'      => $this->config->item('site_name'),
    'sitelang'      => $this->config->item('site_lang'),
    'pagename'      => $this->config->item('page_name'),
    'csspage'       => $this->config->item('css_page'),
    'charset'       => $this->config->item('charset','head_meta'),
    'description'   => $this->config->item('description','head_meta'),
    'keywords'      => $this->config->item('keywords','head_meta'),
    'stylesheets'   => $this->config->item('stylesheets','head_meta'),
    'scripts'       => $this->config->item('scripts','head_meta'),
    'sidebars'      => $this->config->item('sidebars')
);

/* Template variables */
$cfg_assetsUrl = base_url() . 'assets';

// If pagename exists than concatenate it with a sitename, else output only sitename
if(!empty($cfg_template['pagename'])){
    $title = $cfg_template['pagename'] . ' - ' . $cfg_template['sitename'];
}else{
    $title = $cfg_template['sitename'];
}

And one part in my main template layout is block with sidebars:

<div id="tpl-sidebar">
  <?php foreach($cfg_template['sidebars'] as $sidebar):?>
    <?php $this->load->view('modules/'. $sidebar);?>
  <?php endforeach ;?>
</div>

And at last, it loads a application/views/home.php into the specific div block inside applications/views/template/template.php. This is a /views/home.php:

<?php

// No direct acces to this file
if (!defined('BASEPATH')) exit('No direct script access allowed');

// Page configuration
$this->config->set_item('page_name','Homepage');
$this->config->set_item('css_page','home');
$this->config->set_item('alias','home');

?>

    <p>
        WELCOME BLABLABLA
    </p>
</h3>

There is a section where i can define/overwrite a default values from config/template.php and use a specific ones for each views. So my questions is, how can i extend a $config[sidebar] array inside this view file by inserting some new items, for exemple: recent.php,rss.php etc… ?

Sorry for a big code.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T15:55:07+00:00Added an answer on June 9, 2026 at 3:55 pm

    Ok, i got it:

    this is what i should insert inside of a views/home.php:

    $this->config->set_item('sidebars',array(
      'recent',
      'rss'
    ));
    

    Thanks anyway.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
In my XML file chapters tag has more chapter tag.i need to display chapters
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I am currently running into a problem where an element is coming back from
I have thousands of HTML files to process using Groovy/Java and I need to
I have a view passing on information from a database: def serve_article(request, id): served_article
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.