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 8598317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:07:26+00:00 2026-06-12T01:07:26+00:00

On my administrator cms I can add newsitems and add a language code in

  • 0

On my administrator cms I can add newsitems and add a language code in column ‘language’ to the newsitem ‘en’ or ‘nl’. In the bootstrapfile the language is set through:

public function _initLanguage()
{
    $objSessionLanguage= new Zend_Session_Namespace('Zend_Lang'); 
    $objLocale = new Zend_Locale();
    $locale = new Zend_Locale();
    $language = $locale->getLanguage();
    $region = $locale->getRegion();
    Zend_Loader::loadClass('Zend_Controller_Request_Http');
    $request = new Zend_Controller_Request_Http();

    if($language=='nl' or $language=='en')
    {
        if($language=='nl')
        {
            $localFile = 'dutch.php';        
            $Locale = 'nl';
        }else
        {           {
                $localFile = 'english.php';      
                $Locale = 'en';

        }
        $objSessionLanguage->localFile=$localFile;
        $objSessionLanguage->Locale=$Locale;

    }else
    {
        if(!isset($objSessionLanguage->localFile))
        {
            $localFile = 'english.php';      
            $Locale = 'en';
        }else
        {
            $localFile = $objSessionLanguage->localFile;
            $Locale =$objSessionLanguage->Locale;
        }           
    }

    $objTranslate = new Zend_Translate('array', APPLICATION_PATH .'/../language/english.php', 'en');
    $objTranslate->addTranslation(APPLICATION_PATH .'/../language/'.$localFile, $Locale);
    $objTranslate->setLocale($Locale);
    Zend_Registry::set("Zend_Translate", $objTranslate);
}

To display newsitems in a NewsList I want to select the newsitems in the newsmodel depending on language.

<?php

class Admin_Model_News extends  Zend_Db_Table_Abstract
{
    protected $_modelName = 'news';
    protected $_modelLabel = 'News';
    protected $_name = 'news';  
    protected $_objGeneralSettingVar;

public function init()
{
    parent::init(); 
    $this->_objGeneralSettingVar =  Zend_Registry::get( "objGeneralSettingVar");
}    
public function fetchNewsList()
{
    $objSelect = $this->select()->limit(5);
    $objSelect->where ("language = '$language'");
    $objSelect->order("news_date DESC");

    return $this->fetchAll($objSelect)->toArray(); 
}
}

But with the above

$objSelect->where ("language = '$language'");

no newsitems is displayed. I am sure I am missing something but can not seem to find it. How can I use the language setting in selecting newsitems on language?

  • 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-12T01:07:28+00:00Added an answer on June 12, 2026 at 1:07 am

    In Admin_Model_News you are using

    $objSelect->where ("language = '$language'");
    

    for your where clause, but $language has not been set anywhere, so you are querying Where language = null.

    The function fetchNewsList should look like this:-

    public function fetchNewsList($language)
    {
        $objSelect = $this->select()->limit(5);
        $objSelect->where ("language = '$language'");
        $objSelect->order("news_date DESC");
    
        return $this->fetchAll($objSelect)->toArray(); 
    }
    

    You don’t show how you are using Admin_Model_News, but it should be something like this:-

    $news = new Admin_Model_News();
    $newList = $news->fetchNewsList(howeverYouGetlanguage());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my CMS application, administration users can add HTML content via a WYSIWYG editor
How can I launch an application with administrator rights after I have completed an
I want to redirect adm folder to administrator my .htaccess code: Redirect 301 /adm
I am considering using django-cms to implement the following scenario: Admins can create hierarchical
A system administrator told med that memory leaks can be invisible. i.e. all memory
Can we access administrator settings of windows in a Metro-style Windows 8 and Windows
I have been looking round for an open-source CMS framework that I can use
I am building a small cms system. The user can login and edit, delete
I have user (not administrator) access to some external JMS. I'm failing to view
My Windows account has administrator rights on a local SQL Instance. I am able

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.