Jump to content
jane3von

Structure for Revive Adserver-3.2.3

Recommended Posts

Hi, everyone !

I have installed Revive Adserver-3.2.3 in my IDE used Eclipse and the server is wampserver in windows. As I did not learned the php before, so recently I have learned the grammar about the php and the template about smarty. What's more, I found this project has also used PEAR to expand the php function.

I can understand most of the meaning about the code,but I still have some confused about this entire program, especially the entire structure. I saw there was lib folder and it contains java-xmlrpc ,junit,Zend,xmlrpc and some other folders,but I could not understand these folders's function.

I want to modify this project in my demand, but I don't know how to modify especially the UI style. I konw the basic using about smarty,such as templates files are stored in lib/templates/admin, the cache files are generated in var/cache and the grammar about assign() , display(),but I don't understand how to work about the hook, listener,register function?

For example: the template advertiser-index.htm the content is below:

{view_before_content}
{include file=advertiser-index-list.html from=$aAdvertisers aCount=$aCount}
{view_after_content}

I found ViewHook.php has defined the 'view_before_content' and 'view_after_content' like below:

  protected function register(OA_Admin_Template $oTpl)
    {
        $oTpl->register_function('view_before_content', array($this, 'beforeContent'));
        $oTpl->register_function('view_after_content', array($this, 'afterContent'));
    }
    
    
    public function beforeContent($aParams, &$oTpl)
    {
        return OX_Admin_UI_Hooks::beforePageContent($this->pageId, $this->pageData, $oTpl);
    }

 public function afterContent($aParams, &$oTpl)
    {
        return OX_Admin_UI_Hooks::afterPageContent($this->pageId, $this->pageData, $oTpl);
    }

but the function OX_Admin_UI_Hooks::beforePageContent in Hooks.php is 

 

public static function beforePageContent($pageId, $pageData, &$oTpl)
    {
        self::init();
        $result = '';
        $oContext = new OX_Admin_UI_Event_EventContext(array(
            'pageId' => $pageId,
            'pageData' => $pageData,
            'oTpl'     => $oTpl
        )); 
        
        $aStrings = self::getDispatcher()->triggerEvent('beforePageContent', $oContext);
        if (!empty($aStrings)) {
            $result = join('\n', $aStrings); 
        }

        return $result; 
    }

The self::getDispatcher()->triggerEvent() function is in EventDispatcher.php and the function is below:

 public function triggerEvent($eventName, OX_Admin_UI_Event_EventContext $context)
    {
        $aCallbacks = $this->getRegisteredListeners($eventName);
        
        //enhance context with event name
        $context->eventName = $eventName;  
        
        $result = array();
        //invoke event on listener and collect results 
        foreach ($aCallbacks as $callback) {
            $result[] = call_user_func($callback, $context);
        }
        
        return $result;
    }

According to my understanding, the call_user_func() finally execute the function is 'beforePageContent' but the function 'beforePageContent' seems has nothing connected with the html and css files, so I do not know where to call these UI file(htm,css,js) ?

Thanks to anyone can help me about this question!

Share this post


Link to post
Share on other sites

For requirements and some more technical information see: https://www.revive-adserver.com/support/requirements/

If you want to work with the code, I would recommend to go to the Github page at https://github.com/revive-adserver/revive-adserver/ , to fork the repository and then work from that.

Thanks!  I have download the code and run the code.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




×
×
  • Create New...