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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:06:50+00:00 2026-05-15T06:06:50+00:00

I’ve been searching for tutorials to better understand this, but I’m having no luck.

  • 0

I’ve been searching for tutorials to better understand this, but I’m having no luck. Please forgive the lengthy explination, but I want make sure I explain myself well.

First, I’m quite new to the MVC structure, though I have been doing tutorials and learning as best I can.

I have been moving over a live site into the Zend Framework model. So far, I have all the views within views/scripts/index/example.phtml.

So therefore I’m using one IndexController and I have the code in each Action method for each page: IE public function exampleAction()

Because I didn’t know how to interact with a model, I put all the methods at the bottom of the controller (a fat controller).

So basically, I had a working site by using a View and Controller and no model.

…

Now I’m trying to learn how to incorporate the Model.

So I created a View at:

view/scripts/calendar/index.phtml

I created a new Controller at:

controller/CalendarControllers.php

and a new model at:

model/Calendar.php

The problem is I think I’m not correctly communication with the model (I’m still new to OOP).

Can you look over my controller and model and tell me if you see a problem.

I’m needing to return an array from runCalendarScript(), but I’m not sure if I can return an array into the object like I’m trying to? I don’t really understand how to “run” the runCalendarScript() from the controller?

Thanks for any help! I’m stripping out most of the guts of the methods for the sake of brevity:

controller:

<?php

class CalendarController extends Zend_Controller_Action
{

    public function indexAction()
    {
        $finishedFeedArray = new Application_Model_Calendar(); 

  $this->view->googleArray = $finishedFeedArray;
    }
}

model:

   <?php

    class Application_Model_Calendar
    {

 public function _runCalendarScript(){
     $gcal = $this->_validateCalendarConnection();
     $uncleanedFeedArray = $this->_getCalendarFeed($gcal);
     $finishedFeedArray = $this->_cleanFeed($uncleanedFeedArray); 

     return $finishedFeedArray;

 }


    //Validate Google Calendar connection
    public function _validateCalendarConnection()
    {
     ...
        return $gcal;
    }


    //extracts googles calendar object into the $feed object
    public function _getCalendarFeed($gcal)
    {
     ...
     return $feed;
    }

    //cleans the feed to just text, etc
    protected function _cleanFeed($uncleanedFeedArray)
    {
 $contentText = $this->_cleanupText($event);
        $eventData = $this->_filterEventDetails($contentText);

 return $cleanedArray;
     }

     //Cleans up all formatting of text from Calendar feed
     public function _cleanupText($event)
     {
 ...
 return $contentText;
      }



       //filterEventDetails 
       protected function _filterEventDetails($contentText)  
        {
             ...
             return $data;
 }
    }

Edit: sorry-I don’t know why my formatting on the code keeps looking so ugly…

  • 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-05-15T06:06:51+00:00Added an answer on May 15, 2026 at 6:06 am

    Joel,
    So you’re putting the entire model object into a variable called $finishedFeedArray, that’s going to get confusing (it’s not an array, it’s an object).

    I think that’s where your problem is. You’re then trying to give this variable to your view, I assume to show values in your view. In your view script any attempt to treat this variable like an array is going to cause problems.

    Try this:

    class CalendarController extends Zend_Controller_Action
    {
    
        public function indexAction()
        {
            $calendar = new Application_Model_Calendar(); 
    
            $this->view->googleArray = $calendar->_runCalendarScript();
        }
    }
    

    There’s a minor style issue there… I wouldn’t name a public function with an underscore as the first character. Otherwise, this change should get at least one kink out of your code.

    • 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 want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I want to construct a data frame in an Rcpp function, but when I
I have a jquery bug and I've been looking for hours now, I can't
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
this is what i have right now Drawing an RSS feed into the php,

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.