পৃষ্ঠাসমূহ

Search Your Article

CS

 

Welcome to GoogleDG – your one-stop destination for free learning resources, guides, and digital tools.

At GoogleDG, we believe that knowledge should be accessible to everyone. Our mission is to provide readers with valuable ebooks, tutorials, and tech-related content that makes learning easier, faster, and more enjoyable.

What We Offer:

  • 📘 Free & Helpful Ebooks – covering education, technology, self-development, and more.

  • 💻 Step-by-Step Tutorials – practical guides on digital tools, apps, and software.

  • 🌐 Tech Updates & Tips – simplified information to keep you informed in the fast-changing digital world.

  • 🎯 Learning Support – resources designed to support students, professionals, and lifelong learners.

    Latest world News 

     

Our Vision

To create a digital knowledge hub where anyone, from beginners to advanced learners, can find trustworthy resources and grow their skills.

Why Choose Us?

✔ Simple explanations of complex topics
✔ 100% free access to resources
✔ Regularly updated content
✔ A community that values knowledge sharing

We are continuously working to expand our content library and provide readers with the most useful and relevant digital learning materials.

📩 If you’d like to connect, share feedback, or suggest topics, feel free to reach us through the Contact page.

Pageviews

Wednesday, March 8, 2017

Phalcon - Asset Management

Assets are all about the additional components apart from the existing framework in Phalcon. Phalcon has an asset manager which helps to manage all the asset components like CSS or JS files.
The common methods used are −

Method Importance
__construct(variable $options) Initializes the component Phalcon\Assets\Manager
addCss(string $path, variable $local, variable $filter, variable $attributes) Adds a CSS resource from the 'css' collection to a particular view
addJs(string $path, variable $local, variable $filter, variable $attributes) Adds a JavaScript resource to the 'js' collection

Example

Consider the sample project of Phalcon “vokuro” which is the best illustration for adding css files. It will include assets/Manager for invoking all the css files.
The default controller for the project will invoke all the css files.
<?php 

namespace Vokuro\Controllers; 
use Phalcon\Assets\Manager;  

/** 
   * Display the default index page. 
*/ 

class IndexController extends ControllerBase {  
   /** 
      * Default action. Set the public layout (layouts/public.volt) 
   */ 
   public function indexAction() { 
      $this->assets->addCss("public/style.css"); 
      $this->view->setVar('logged_in', is_array($this->auth->getIdentity())); 
      $this->view->setTemplateBefore('public'); 
   } 
}

Style.css

div.remember { 
   margin-top: 7px; 
   color: #969696; 
}  
div.remember label { 
   padding-top: 15px; 
}  
div.forgot { 
   margin-top: 7px; 
   color: #dadada; 
}  
footer { 
   background: url("../img/feature-gradient.png") no-repeat scroll center 100% white; 
   color: #B7B7B7; 
   font-size: 12px; 
   padding: 30px 0; 
   text-align: center; 
}  
footer a { 
   margin-left: 10px; 
   margin-right: 10px; 
}  
table.signup td { 
   padding: 10px; 
}  
table.signup .alert { 
   margin-bottom: 0; 
   margin-top: 3px; 
}  
table.perms select { 
   margin-top: 5px; 
   margin-right: 10px; 
}  
table.perms label { 
   margin-right: 10px; 
}  
div.main-container { 
   min-height: 450px; 
} 
The assets will be managed inside views, which will display css files as an output.

Index.volt

{{ content() }} 
{{ assets.outputCss() }} 

<header class = "jumbotron subhead" id = "overview"> 
   <div class = "hero-unit"> 
      <h1>Welcome!</h1> 
      <p class = "lead">This is a website secured by Phalcon Framework</p> 
      <div align = "right"> 
         {{ link_to('session/signup', '<i class="icon-ok icon-white">
            </i> Create an Account', 'class': 'btn btn-primary btn-large') }} 
      </div> 
   </div> 
</header> 

Output

It will produce the following output −
Produced Output

No comments:

Post a Comment