SlideShare une entreprise Scribd logo
1  sur  30
INTRODUCTION TOINTRODUCTION TO
ASSET MANAGEMENTASSET MANAGEMENT
IN XOOPS CMS ENVIRONMENTIN XOOPS CMS ENVIRONMENT
XOOPS 2.6.0XOOPS 2.6.0
Education SeriesEducation Series
Richard Griffith
XOOPS Core Team Leader
April 2014© 2014 XOOPS Foundation www.xoops.org
2
© 2014 XOOPS Foundation www.xoops.org
ASSETS
Most of the focus in XOOPS asset management
is on stylesheet and script assets.
Most of the focus in XOOPS asset management
is on stylesheet and script assets.
A web page
consists of a base
HTML document
and any additional
files it may include,
such as
stylesheets,
scripts, images and
fonts. We will refer
to these additional
files as assets.
HTML
Text
Images
Media
HTML
Text
Images
Media
CSS
Page
layout
Text styles
CSS
Page
layout
Text styles
JS, PHP,etc
Scripts
Database
Interraction
JS, PHP,etc
Scripts
Database
Interraction
Content FunctionsStyles
+ +
3
© 2014 XOOPS Foundation www.xoops.org
Assets are a very
important part of the
user experience.
For today's rich, highly
interactive web
applications, the asset
performance may be
more significant than the
backend application and
database performance.
ASSETS ARE VALUABLE
Source: http://www.stevesouders.com/
4
© 2014 XOOPS Foundation www.xoops.org
ASSET PERFORMANCE FACTORS
Asset size
Number of files
Latency
● Network speed
 Connection set up an tear down
 Transfer rate
 Currency limits
● Client capacity
 Processing power/load
 Memory
 Cache speed
5
© 2014 XOOPS Foundation www.xoops.org
MANAGEMENT STRATEGIES
Minimize file sizes
Combine files to reduce network
connections
Serve assets as static files to
maximize caching
Avoid concurrency bottlenecks
●Assets that include other assets when
loaded
6
© 2014 XOOPS Foundation www.xoops.org
DEVELOPMENT VS. DEPLOYMENT
Develop / Debug
●Easy to read and
edit is essential
●Separate files are
easier to work with
and my come from
different sources
Deployment Focus
●Eliminate formatting
and whitespace
●Combine files to
eliminate latency
7
© 2014 XOOPS Foundation www.xoops.org
SOLVED WITH ASSET MANAGEMENT
Develop / Debug
●Easy to read and
edit is essential
●Separate files are
easier to work with
Asset management solves the
development vs. deployment
dilemma by using the exact same
sources for both needs.
Asset management solves the
development vs. deployment
dilemma by using the exact same
sources for both needs.
Deployment Focus
●Eliminate formatting
and whitespace
●Combine files to
eliminate latency
8
© 2014 XOOPS Foundation www.xoops.org
THE BASICS
Specify a file or set of files as an asset
Specify filters to apply to that asset
Create a static file from the asset for
the browser to load which :
●Contains the content of all the specified files
●Has all the specified filters applied
●Is transferred as a single unit
Asset Management allows you to:
9
© 2014 XOOPS Foundation www.xoops.org
XOOPS Asset Management is built on
Assetic, by Kris Wallsmith. For a
deeper understanding of some of the
concepts, review the documentation
available at:
https://github.com/kriswallsmith/assetic
THE BASICS - CONTINUED
10
© 2014 XOOPS Foundation www.xoops.org
THE BASICS - FILES
An asset can be a set of script or
stylesheet files, not both
An asset is defined by an array of file
specifications
A file can be specified by a fully
qualified filesystem name, or by a
path resolvable by the XOOPS path()
function
A file specification can also be a
wildcard pattern
11
© 2014 XOOPS Foundation www.xoops.org
XOOPS Asset Management comes configured
with a subset of the possible Assetic filters.
One major criteria for the selection of these
filters is they are all implemented in PHP and
require no additional binary packages to be
installed on the server. These filters are
portable and will be available for use where
ever XOOPS is installed.
Filters are specified as a string of comma
separated filter names. A filter name can be
preceded with a question mark (“?”) to turn it
off during debugging.
THE BASICS - FILTERS
12
© 2014 XOOPS Foundation www.xoops.org
THE BASICS–FILTERS-CONTINUED
Filter Name Assetic Filter Name Description
cssembed PhpCssEmbedFilter embeds image data in your
stylesheets
cssimport CssImportFilter inlines imported stylesheets
cssmin CssMinFilter minifies CSS
cssrewrite CssRewriteFilter fixes relative URLs in CSS
lessphp LessphpFilter Complile LESS to CSS
scssphp ScssphpFilter Compile SCSS to CSS
jsmin JSMinFilter minifies Javascript
These are the available filters :
13
© 2014 XOOPS Foundation www.xoops.org
THE BASICS–FILTERS-CONTINUED
If no filters are specified, default
filters will be applied.
● Stylesheets
– 'cssimport,cssembed,?cssmin'
● Javascript
– '?jsmin'
14
© 2014 XOOPS Foundation www.xoops.org
ASSETS LOCATION : CORE
● Managed assets are stored in the
“assets” directory in the XOOPS web
root
– stylesheets in css sub-directory
– scripts in js sub-directory
● These managed directories can be
cleared, and contents will be
recreated as needed
● Other subdirectories, such as fonts,
are managed differently
15
© 2014 XOOPS Foundation www.xoops.org
ASSETS LOCATION : MODULES
● Module's Assets are
also placed in an
“assets” folder, similar
to Core
● In order to take
advantage of Assetic,
current modules should
convert to this folder
structure
16
© 2014 XOOPS Foundation www.xoops.org
LAZY MANAGEMENT
● Each page load specifies the set of assets
it needs
● The lists of files, modification times, and
filters to apply are used to build unique
asset names
● If the static file with that name does not
exist, the asset files are processed and
filtered, and the static file is created
● There are no separate formula extraction
or preprocessing steps needed
17
© 2014 XOOPS Foundation www.xoops.org
EXISTING FUNCTIONS
XOOPS has historically provided two
methods in the XoopsTheme class to
deal with assets:
● addScript($url)
● addStylesheet($url)
* Note that these methods expect
URLs, not filesystem paths.
18
© 2014 XOOPS Foundation www.xoops.org
NEW ASSET FUNCTION
The XoopsTheme class has been expanded
to better manage assets. The following
methods are available:
● addScriptAssets($assets, $filters)
● addStylesheetAssets($assets, $filters)
● addBaseScriptAssets($assets)
● addBaseStylesheetAssets($assets)
● setNamedAsset($name, $assets, $filters)
19
© 2014 XOOPS Foundation www.xoops.org
addScriptAssets &
addStylesheetAssets
● Accept an array of one or more
asset file specifications
● Optionally accept a string of comma
separated filter names
● Result in combining and filtering
the assets, then adding the URL for
the created static asset file to the
same lists used by addScript() and
addStylesheet()
20
© 2014 XOOPS Foundation www.xoops.org
addBaseScriptAssets &
addBaseStylesheetAssets
● Accept an array of one or more
asset file specifications
● Accumulate asset files in separate
lists, similar to addScript() and
addStylesheet()
● Assets are processed using default
filters and the resulting static file
URL is added to the top of
respective list in the page headers:
<{$xoops_module_header}>
21
© 2014 XOOPS Foundation www.xoops.org
BASE ASSETS
● Core uses the base assets for common
system wide assets, such as jQuery,
jQueryUI, locale and Bootstrap assets
● Themes can add to the base assets using
theme_onload.php
● Modules may want to add their common
assets to the base asset
● Browser cache use is improved if the same
base asset definition is used for many
pages
22
© 2014 XOOPS Foundation www.xoops.org
setNamedAsset
● Accepts a unique asset name
● Accepts an array of one or more
asset file specifications
● Optionally accepts a string of
comma separated filter names
● Results in creating an asset
reference that can be specified in
asset arrays in place of a file
specification
23
© 2014 XOOPS Foundation www.xoops.org
NAMED ASSETS
● Named assets allow symbolic reference
to commonly used assets (i.e. “jquery”)
● Named assets can be given additional
filters
● Using setNamedAsset does not create the
asset, it just records the name and
definition
● To use an asset named “jquery” include
an asset name of “@jquery” in an asset
list
24
© 2014 XOOPS Foundation www.xoops.org
SMARTY ASSETS TAG
The Smarty block plugin allows assets
to be defined in templates. Full
syntax:
<{assets
assets="(file specifications, comma separated)”
output="(css or js)"
debug=(true or false)
filters="(filter list, comma separated)"
asset_url=(smarty variable for asset url)
}>
<link rel="stylesheet" href="<{$asset_url}>">
<{/assets}>
25
© 2014 XOOPS Foundation www.xoops.org
ASSETS TAG ARGUMENT
● assets - comma separated list of assets
to process.
● output - type of output, “css” or “js”
● debug - true to enable debug mode,
default is false
● filters - list of filters to apply, if not
specifed will use default filters for output
type
● asset_url - smarty variable to assign
asset path, defaults to “asset_url”
26
© 2014 XOOPS Foundation www.xoops.org
BEHIND THE SCENES
● XoopsCoreAssets.php handles
communication with the Assetic
library
● Xoops object establishes a single
instance of Assets class, and
XoopsTheme references it
● Configuration of Assets class is in
xoops_path/configs/system_assets_p
refs.yml, but it normally should not
need to be changed
27
© 2014 XOOPS Foundation www.xoops.org
copyFileAssets()
To handle fonts and images in some special
circumstances, a file copy function is
provided.
XoopsCoreAssets::copyFileAssets()
This method copies files to the asset
directory. Copying is normally only needed
for fonts or images when they are
referenced by a relative URL in a stylesheet,
or are located outside of the web root, as
might be the case of a file asset located in a
vendor package.
28
© 2014 XOOPS Foundation www.xoops.org
TURNING ON DEBUG
● Easiest way is to include ASSET_DEBUG=1
in the URL, i.e. index.php?
ASSET_DEBUG=1
● Add this call to your code:
Xoops::getInstance()->assets()->setDebug(true);
● Add debug=true to a Smarty assets tag
● Any of these will turn off any filters
prefixed with a question mark (by default
cssmin and jsmin)
29
© 2014 XOOPS Foundation www.xoops.org
The best source of asset management
examples is in XOOPS 2.6.0 itself.
EXAMPLES
30
© 2014 XOOPS Foundation www.xoops.org
If you have any suggestions,
comments or questions, please make
them known.
You can contact the author here :
richard@geekwright.com
IDEAS ? QUESTIONS ?
www.xoops.org

Contenu connexe

Tendances

RESTful Web Services with Jersey
RESTful Web Services with JerseyRESTful Web Services with Jersey
RESTful Web Services with JerseyScott Leberknight
 
20110606 e z_flow_gig_v1
20110606 e z_flow_gig_v120110606 e z_flow_gig_v1
20110606 e z_flow_gig_v1Gilles Guirand
 
Php Applications with Oracle by Kuassi Mensah
Php Applications with Oracle by Kuassi MensahPhp Applications with Oracle by Kuassi Mensah
Php Applications with Oracle by Kuassi MensahPHP Barcelona Conference
 
Database Connection With Mysql
Database Connection With MysqlDatabase Connection With Mysql
Database Connection With MysqlHarit Kothari
 
#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...탑크리에듀(구로디지털단지역3번출구 2분거리)
 
Moodle 3.3 - API Change Overview #mootieuk17
Moodle 3.3 - API Change Overview #mootieuk17Moodle 3.3 - API Change Overview #mootieuk17
Moodle 3.3 - API Change Overview #mootieuk17Dan Poltawski
 
Drupal8 corporate training in Hyderabad
Drupal8 corporate training in HyderabadDrupal8 corporate training in Hyderabad
Drupal8 corporate training in Hyderabadphp2ranjan
 
RESTful Web services using JAX-RS
RESTful Web services using JAX-RSRESTful Web services using JAX-RS
RESTful Web services using JAX-RSArun Gupta
 
Make your gui shine with ajax solr
Make your gui shine with ajax solrMake your gui shine with ajax solr
Make your gui shine with ajax solrlucenerevolution
 
Wordpress Workflow
Wordpress Workflow Wordpress Workflow
Wordpress Workflow Filippo Dino
 
Architecture of Drupal - Drupal Camp
Architecture of Drupal - Drupal CampArchitecture of Drupal - Drupal Camp
Architecture of Drupal - Drupal CampDipen Chaudhary
 
Rich Internet Applications con JavaFX e NetBeans
Rich Internet Applications  con JavaFX e NetBeans Rich Internet Applications  con JavaFX e NetBeans
Rich Internet Applications con JavaFX e NetBeans Fabrizio Giudici
 
13th Sep, Drupal 7 advanced training by TCS
13th Sep, Drupal 7 advanced training by TCS 13th Sep, Drupal 7 advanced training by TCS
13th Sep, Drupal 7 advanced training by TCS DrupalMumbai
 
Drupal 8 - Corso frontend development
Drupal 8 - Corso frontend developmentDrupal 8 - Corso frontend development
Drupal 8 - Corso frontend developmentsparkfabrik
 
Migrate yourself. code -> module -> mind
Migrate yourself. code -> module -> mindMigrate yourself. code -> module -> mind
Migrate yourself. code -> module -> mindValentine Matsveiko
 
ZF2 for the ZF1 Developer
ZF2 for the ZF1 DeveloperZF2 for the ZF1 Developer
ZF2 for the ZF1 DeveloperGary Hockin
 

Tendances (20)

RESTful Web Services with Jersey
RESTful Web Services with JerseyRESTful Web Services with Jersey
RESTful Web Services with Jersey
 
20110606 e z_flow_gig_v1
20110606 e z_flow_gig_v120110606 e z_flow_gig_v1
20110606 e z_flow_gig_v1
 
Php Applications with Oracle by Kuassi Mensah
Php Applications with Oracle by Kuassi MensahPhp Applications with Oracle by Kuassi Mensah
Php Applications with Oracle by Kuassi Mensah
 
Database Connection With Mysql
Database Connection With MysqlDatabase Connection With Mysql
Database Connection With Mysql
 
#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
 
Moodle 3.3 - API Change Overview #mootieuk17
Moodle 3.3 - API Change Overview #mootieuk17Moodle 3.3 - API Change Overview #mootieuk17
Moodle 3.3 - API Change Overview #mootieuk17
 
Drupal8 corporate training in Hyderabad
Drupal8 corporate training in HyderabadDrupal8 corporate training in Hyderabad
Drupal8 corporate training in Hyderabad
 
RESTful Web services using JAX-RS
RESTful Web services using JAX-RSRESTful Web services using JAX-RS
RESTful Web services using JAX-RS
 
Make your gui shine with ajax solr
Make your gui shine with ajax solrMake your gui shine with ajax solr
Make your gui shine with ajax solr
 
Wordpress Workflow
Wordpress Workflow Wordpress Workflow
Wordpress Workflow
 
Architecture of Drupal - Drupal Camp
Architecture of Drupal - Drupal CampArchitecture of Drupal - Drupal Camp
Architecture of Drupal - Drupal Camp
 
Java JDBC
Java JDBCJava JDBC
Java JDBC
 
Rich Internet Applications con JavaFX e NetBeans
Rich Internet Applications  con JavaFX e NetBeans Rich Internet Applications  con JavaFX e NetBeans
Rich Internet Applications con JavaFX e NetBeans
 
Php with MYSQL Database
Php with MYSQL DatabasePhp with MYSQL Database
Php with MYSQL Database
 
Apache servicemix1
Apache servicemix1Apache servicemix1
Apache servicemix1
 
13th Sep, Drupal 7 advanced training by TCS
13th Sep, Drupal 7 advanced training by TCS 13th Sep, Drupal 7 advanced training by TCS
13th Sep, Drupal 7 advanced training by TCS
 
Introduction to CakePHP
Introduction to CakePHPIntroduction to CakePHP
Introduction to CakePHP
 
Drupal 8 - Corso frontend development
Drupal 8 - Corso frontend developmentDrupal 8 - Corso frontend development
Drupal 8 - Corso frontend development
 
Migrate yourself. code -> module -> mind
Migrate yourself. code -> module -> mindMigrate yourself. code -> module -> mind
Migrate yourself. code -> module -> mind
 
ZF2 for the ZF1 Developer
ZF2 for the ZF1 DeveloperZF2 for the ZF1 Developer
ZF2 for the ZF1 Developer
 

Similaire à XOOPS 2.6.0 Assets Management using Assetic

What's New in Nuxeo Platform 7.3
What's New in Nuxeo Platform 7.3 What's New in Nuxeo Platform 7.3
What's New in Nuxeo Platform 7.3 Nuxeo
 
Solr Application Development Tutorial
Solr Application Development TutorialSolr Application Development Tutorial
Solr Application Development TutorialErik Hatcher
 
Alfresco overview EDM
Alfresco overview EDMAlfresco overview EDM
Alfresco overview EDMsang nguyen
 
AEM Asset and Tag API
AEM Asset and Tag APIAEM Asset and Tag API
AEM Asset and Tag APILokesh BS
 
Silverlight Development & The Model-View-ViewModel Pattern
Silverlight Development & The Model-View-ViewModel PatternSilverlight Development & The Model-View-ViewModel Pattern
Silverlight Development & The Model-View-ViewModel PatternDerek Novavi
 
The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017Amanda Giles
 
CMS Lessons Learned at Vassar by Megg Brown
CMS Lessons Learned at Vassar by Megg BrownCMS Lessons Learned at Vassar by Megg Brown
CMS Lessons Learned at Vassar by Megg Brownhannonhill
 
AEM Sightly Deep Dive
AEM Sightly Deep DiveAEM Sightly Deep Dive
AEM Sightly Deep DiveGabriel Walt
 
Decoupling Drupal 8.x: Drupal’s Web Services Today and Tomorrow
Decoupling Drupal 8.x: Drupal’s Web Services Today and TomorrowDecoupling Drupal 8.x: Drupal’s Web Services Today and Tomorrow
Decoupling Drupal 8.x: Drupal’s Web Services Today and TomorrowAcquia
 
Bootstrap4XPages webinar
Bootstrap4XPages webinarBootstrap4XPages webinar
Bootstrap4XPages webinarMark Leusink
 
[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?
[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?
[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?Wong Hoi Sing Edison
 
Introduction to Azure Resource Manager, Global Azure Bootcamp 2016.04
Introduction to Azure Resource Manager, Global Azure Bootcamp 2016.04Introduction to Azure Resource Manager, Global Azure Bootcamp 2016.04
Introduction to Azure Resource Manager, Global Azure Bootcamp 2016.04Lukasz Kaluzny
 
Extending Build to the Client: A Maven User's Guide to Grunt.js
Extending Build to the Client: A Maven User's Guide to Grunt.jsExtending Build to the Client: A Maven User's Guide to Grunt.js
Extending Build to the Client: A Maven User's Guide to Grunt.jsPetr Jiricka
 
The Way to Theme Enlightenment
The Way to Theme EnlightenmentThe Way to Theme Enlightenment
The Way to Theme EnlightenmentAmanda Giles
 
Developing Branding Solutions for 2013
Developing Branding Solutions for 2013Developing Branding Solutions for 2013
Developing Branding Solutions for 2013Thomas Daly
 
Developing Branding Solutions for 2013
Developing Branding Solutions for 2013Developing Branding Solutions for 2013
Developing Branding Solutions for 2013Thomas Daly
 
Azure for SharePoint Developers - Workshop - Part 3: Web Services
Azure for SharePoint Developers - Workshop - Part 3: Web ServicesAzure for SharePoint Developers - Workshop - Part 3: Web Services
Azure for SharePoint Developers - Workshop - Part 3: Web ServicesBob German
 

Similaire à XOOPS 2.6.0 Assets Management using Assetic (20)

What's New in Nuxeo Platform 7.3
What's New in Nuxeo Platform 7.3 What's New in Nuxeo Platform 7.3
What's New in Nuxeo Platform 7.3
 
Solr Application Development Tutorial
Solr Application Development TutorialSolr Application Development Tutorial
Solr Application Development Tutorial
 
Apache Kite
Apache KiteApache Kite
Apache Kite
 
WordPress Theming 101
WordPress Theming 101WordPress Theming 101
WordPress Theming 101
 
Alfresco overview EDM
Alfresco overview EDMAlfresco overview EDM
Alfresco overview EDM
 
AEM Asset and Tag API
AEM Asset and Tag APIAEM Asset and Tag API
AEM Asset and Tag API
 
Silverlight Development & The Model-View-ViewModel Pattern
Silverlight Development & The Model-View-ViewModel PatternSilverlight Development & The Model-View-ViewModel Pattern
Silverlight Development & The Model-View-ViewModel Pattern
 
The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017
 
CMS Lessons Learned at Vassar by Megg Brown
CMS Lessons Learned at Vassar by Megg BrownCMS Lessons Learned at Vassar by Megg Brown
CMS Lessons Learned at Vassar by Megg Brown
 
Asp folders and web configurations
Asp folders and web configurationsAsp folders and web configurations
Asp folders and web configurations
 
AEM Sightly Deep Dive
AEM Sightly Deep DiveAEM Sightly Deep Dive
AEM Sightly Deep Dive
 
Decoupling Drupal 8.x: Drupal’s Web Services Today and Tomorrow
Decoupling Drupal 8.x: Drupal’s Web Services Today and TomorrowDecoupling Drupal 8.x: Drupal’s Web Services Today and Tomorrow
Decoupling Drupal 8.x: Drupal’s Web Services Today and Tomorrow
 
Bootstrap4XPages webinar
Bootstrap4XPages webinarBootstrap4XPages webinar
Bootstrap4XPages webinar
 
[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?
[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?
[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?
 
Introduction to Azure Resource Manager, Global Azure Bootcamp 2016.04
Introduction to Azure Resource Manager, Global Azure Bootcamp 2016.04Introduction to Azure Resource Manager, Global Azure Bootcamp 2016.04
Introduction to Azure Resource Manager, Global Azure Bootcamp 2016.04
 
Extending Build to the Client: A Maven User's Guide to Grunt.js
Extending Build to the Client: A Maven User's Guide to Grunt.jsExtending Build to the Client: A Maven User's Guide to Grunt.js
Extending Build to the Client: A Maven User's Guide to Grunt.js
 
The Way to Theme Enlightenment
The Way to Theme EnlightenmentThe Way to Theme Enlightenment
The Way to Theme Enlightenment
 
Developing Branding Solutions for 2013
Developing Branding Solutions for 2013Developing Branding Solutions for 2013
Developing Branding Solutions for 2013
 
Developing Branding Solutions for 2013
Developing Branding Solutions for 2013Developing Branding Solutions for 2013
Developing Branding Solutions for 2013
 
Azure for SharePoint Developers - Workshop - Part 3: Web Services
Azure for SharePoint Developers - Workshop - Part 3: Web ServicesAzure for SharePoint Developers - Workshop - Part 3: Web Services
Azure for SharePoint Developers - Workshop - Part 3: Web Services
 

Dernier

A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 

Dernier (20)

A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 

XOOPS 2.6.0 Assets Management using Assetic

  • 1. INTRODUCTION TOINTRODUCTION TO ASSET MANAGEMENTASSET MANAGEMENT IN XOOPS CMS ENVIRONMENTIN XOOPS CMS ENVIRONMENT XOOPS 2.6.0XOOPS 2.6.0 Education SeriesEducation Series Richard Griffith XOOPS Core Team Leader April 2014© 2014 XOOPS Foundation www.xoops.org
  • 2. 2 © 2014 XOOPS Foundation www.xoops.org ASSETS Most of the focus in XOOPS asset management is on stylesheet and script assets. Most of the focus in XOOPS asset management is on stylesheet and script assets. A web page consists of a base HTML document and any additional files it may include, such as stylesheets, scripts, images and fonts. We will refer to these additional files as assets. HTML Text Images Media HTML Text Images Media CSS Page layout Text styles CSS Page layout Text styles JS, PHP,etc Scripts Database Interraction JS, PHP,etc Scripts Database Interraction Content FunctionsStyles + +
  • 3. 3 © 2014 XOOPS Foundation www.xoops.org Assets are a very important part of the user experience. For today's rich, highly interactive web applications, the asset performance may be more significant than the backend application and database performance. ASSETS ARE VALUABLE Source: http://www.stevesouders.com/
  • 4. 4 © 2014 XOOPS Foundation www.xoops.org ASSET PERFORMANCE FACTORS Asset size Number of files Latency ● Network speed  Connection set up an tear down  Transfer rate  Currency limits ● Client capacity  Processing power/load  Memory  Cache speed
  • 5. 5 © 2014 XOOPS Foundation www.xoops.org MANAGEMENT STRATEGIES Minimize file sizes Combine files to reduce network connections Serve assets as static files to maximize caching Avoid concurrency bottlenecks ●Assets that include other assets when loaded
  • 6. 6 © 2014 XOOPS Foundation www.xoops.org DEVELOPMENT VS. DEPLOYMENT Develop / Debug ●Easy to read and edit is essential ●Separate files are easier to work with and my come from different sources Deployment Focus ●Eliminate formatting and whitespace ●Combine files to eliminate latency
  • 7. 7 © 2014 XOOPS Foundation www.xoops.org SOLVED WITH ASSET MANAGEMENT Develop / Debug ●Easy to read and edit is essential ●Separate files are easier to work with Asset management solves the development vs. deployment dilemma by using the exact same sources for both needs. Asset management solves the development vs. deployment dilemma by using the exact same sources for both needs. Deployment Focus ●Eliminate formatting and whitespace ●Combine files to eliminate latency
  • 8. 8 © 2014 XOOPS Foundation www.xoops.org THE BASICS Specify a file or set of files as an asset Specify filters to apply to that asset Create a static file from the asset for the browser to load which : ●Contains the content of all the specified files ●Has all the specified filters applied ●Is transferred as a single unit Asset Management allows you to:
  • 9. 9 © 2014 XOOPS Foundation www.xoops.org XOOPS Asset Management is built on Assetic, by Kris Wallsmith. For a deeper understanding of some of the concepts, review the documentation available at: https://github.com/kriswallsmith/assetic THE BASICS - CONTINUED
  • 10. 10 © 2014 XOOPS Foundation www.xoops.org THE BASICS - FILES An asset can be a set of script or stylesheet files, not both An asset is defined by an array of file specifications A file can be specified by a fully qualified filesystem name, or by a path resolvable by the XOOPS path() function A file specification can also be a wildcard pattern
  • 11. 11 © 2014 XOOPS Foundation www.xoops.org XOOPS Asset Management comes configured with a subset of the possible Assetic filters. One major criteria for the selection of these filters is they are all implemented in PHP and require no additional binary packages to be installed on the server. These filters are portable and will be available for use where ever XOOPS is installed. Filters are specified as a string of comma separated filter names. A filter name can be preceded with a question mark (“?”) to turn it off during debugging. THE BASICS - FILTERS
  • 12. 12 © 2014 XOOPS Foundation www.xoops.org THE BASICS–FILTERS-CONTINUED Filter Name Assetic Filter Name Description cssembed PhpCssEmbedFilter embeds image data in your stylesheets cssimport CssImportFilter inlines imported stylesheets cssmin CssMinFilter minifies CSS cssrewrite CssRewriteFilter fixes relative URLs in CSS lessphp LessphpFilter Complile LESS to CSS scssphp ScssphpFilter Compile SCSS to CSS jsmin JSMinFilter minifies Javascript These are the available filters :
  • 13. 13 © 2014 XOOPS Foundation www.xoops.org THE BASICS–FILTERS-CONTINUED If no filters are specified, default filters will be applied. ● Stylesheets – 'cssimport,cssembed,?cssmin' ● Javascript – '?jsmin'
  • 14. 14 © 2014 XOOPS Foundation www.xoops.org ASSETS LOCATION : CORE ● Managed assets are stored in the “assets” directory in the XOOPS web root – stylesheets in css sub-directory – scripts in js sub-directory ● These managed directories can be cleared, and contents will be recreated as needed ● Other subdirectories, such as fonts, are managed differently
  • 15. 15 © 2014 XOOPS Foundation www.xoops.org ASSETS LOCATION : MODULES ● Module's Assets are also placed in an “assets” folder, similar to Core ● In order to take advantage of Assetic, current modules should convert to this folder structure
  • 16. 16 © 2014 XOOPS Foundation www.xoops.org LAZY MANAGEMENT ● Each page load specifies the set of assets it needs ● The lists of files, modification times, and filters to apply are used to build unique asset names ● If the static file with that name does not exist, the asset files are processed and filtered, and the static file is created ● There are no separate formula extraction or preprocessing steps needed
  • 17. 17 © 2014 XOOPS Foundation www.xoops.org EXISTING FUNCTIONS XOOPS has historically provided two methods in the XoopsTheme class to deal with assets: ● addScript($url) ● addStylesheet($url) * Note that these methods expect URLs, not filesystem paths.
  • 18. 18 © 2014 XOOPS Foundation www.xoops.org NEW ASSET FUNCTION The XoopsTheme class has been expanded to better manage assets. The following methods are available: ● addScriptAssets($assets, $filters) ● addStylesheetAssets($assets, $filters) ● addBaseScriptAssets($assets) ● addBaseStylesheetAssets($assets) ● setNamedAsset($name, $assets, $filters)
  • 19. 19 © 2014 XOOPS Foundation www.xoops.org addScriptAssets & addStylesheetAssets ● Accept an array of one or more asset file specifications ● Optionally accept a string of comma separated filter names ● Result in combining and filtering the assets, then adding the URL for the created static asset file to the same lists used by addScript() and addStylesheet()
  • 20. 20 © 2014 XOOPS Foundation www.xoops.org addBaseScriptAssets & addBaseStylesheetAssets ● Accept an array of one or more asset file specifications ● Accumulate asset files in separate lists, similar to addScript() and addStylesheet() ● Assets are processed using default filters and the resulting static file URL is added to the top of respective list in the page headers: <{$xoops_module_header}>
  • 21. 21 © 2014 XOOPS Foundation www.xoops.org BASE ASSETS ● Core uses the base assets for common system wide assets, such as jQuery, jQueryUI, locale and Bootstrap assets ● Themes can add to the base assets using theme_onload.php ● Modules may want to add their common assets to the base asset ● Browser cache use is improved if the same base asset definition is used for many pages
  • 22. 22 © 2014 XOOPS Foundation www.xoops.org setNamedAsset ● Accepts a unique asset name ● Accepts an array of one or more asset file specifications ● Optionally accepts a string of comma separated filter names ● Results in creating an asset reference that can be specified in asset arrays in place of a file specification
  • 23. 23 © 2014 XOOPS Foundation www.xoops.org NAMED ASSETS ● Named assets allow symbolic reference to commonly used assets (i.e. “jquery”) ● Named assets can be given additional filters ● Using setNamedAsset does not create the asset, it just records the name and definition ● To use an asset named “jquery” include an asset name of “@jquery” in an asset list
  • 24. 24 © 2014 XOOPS Foundation www.xoops.org SMARTY ASSETS TAG The Smarty block plugin allows assets to be defined in templates. Full syntax: <{assets assets="(file specifications, comma separated)” output="(css or js)" debug=(true or false) filters="(filter list, comma separated)" asset_url=(smarty variable for asset url) }> <link rel="stylesheet" href="<{$asset_url}>"> <{/assets}>
  • 25. 25 © 2014 XOOPS Foundation www.xoops.org ASSETS TAG ARGUMENT ● assets - comma separated list of assets to process. ● output - type of output, “css” or “js” ● debug - true to enable debug mode, default is false ● filters - list of filters to apply, if not specifed will use default filters for output type ● asset_url - smarty variable to assign asset path, defaults to “asset_url”
  • 26. 26 © 2014 XOOPS Foundation www.xoops.org BEHIND THE SCENES ● XoopsCoreAssets.php handles communication with the Assetic library ● Xoops object establishes a single instance of Assets class, and XoopsTheme references it ● Configuration of Assets class is in xoops_path/configs/system_assets_p refs.yml, but it normally should not need to be changed
  • 27. 27 © 2014 XOOPS Foundation www.xoops.org copyFileAssets() To handle fonts and images in some special circumstances, a file copy function is provided. XoopsCoreAssets::copyFileAssets() This method copies files to the asset directory. Copying is normally only needed for fonts or images when they are referenced by a relative URL in a stylesheet, or are located outside of the web root, as might be the case of a file asset located in a vendor package.
  • 28. 28 © 2014 XOOPS Foundation www.xoops.org TURNING ON DEBUG ● Easiest way is to include ASSET_DEBUG=1 in the URL, i.e. index.php? ASSET_DEBUG=1 ● Add this call to your code: Xoops::getInstance()->assets()->setDebug(true); ● Add debug=true to a Smarty assets tag ● Any of these will turn off any filters prefixed with a question mark (by default cssmin and jsmin)
  • 29. 29 © 2014 XOOPS Foundation www.xoops.org The best source of asset management examples is in XOOPS 2.6.0 itself. EXAMPLES
  • 30. 30 © 2014 XOOPS Foundation www.xoops.org If you have any suggestions, comments or questions, please make them known. You can contact the author here : richard@geekwright.com IDEAS ? QUESTIONS ? www.xoops.org