SlideShare una empresa de Scribd logo
1 de 9
Creating and Theming Custom Content Types Heather Rodriguez UMD Drupal Users Group October 5th, 2011
What is a Content Type? Node: the most basic unit of content Made up of fields of information (ex. Title, Body, URL, etc.) Nodes belong to content types based on fields they share in common Default content types: article (news), blog entry, basic page, book page, forum and poll
Why Create Custom Content Types? Easily and quickly create new nodes that will collect and display the same fields of information Images File upload Text fields Teasers Links etc.
Custom Content Type Example Faculty Bios Name Department Areas of Expertise Research Projects Contact Information Educational background
Customizing Content Types through Template Overrides Copy the content of node template (/sites/all/theme/node.tpl.php)into a blank file  Save as node--your-content-type.tpl.php into the templates folder to override the default node template  Two dashes after node for Drupal 7, 1 for 6 You MUST FOLLOW this naming convention Double-check the machine name of your content type
Customizing Content Types (cont.) Expose array names for styling <?phpprint_r(array_keys($content)) ?>include  Print the arrays that you need to display on the page <?php print render($content [’arraynamehere']) ?> Add your HTML and CSS around the arrays <h3><?php print render($content [’arraynamehere']) ?></h3> or <p class=“paragraphstyle”><?php print render($content[‘arraynamehere’]) ?></p>
Flush the Theme Cache!	 In order to see the effects of your styling, you must empty your theme cache! Configuration > Performance > Clear all caches
Customizing Fields To modify a specific field rather than the entire content type (useful for separating field label from field items): Make a new copy of the field template file (field.tpl.php located in Modules < Field < Theme) and put it into your theme’s template folder (Sites < All < Themes <Templates) Put your HTML and CSS around the field label or items, depending on what you want to modify Save file as field-- field_machinename.tpl.php
Tips	 You can use these same methods of template overrides for Views, Forms, Pages, etc. as well For a full list of possible tpl.php overrides, check out Drupal 7 Template Suggestions: http://drupal.org/node/1089656 Don’t forget to save template overrides in your theme folder! If you don’t see any changes, flush the theme cache. Watch Lin Clark’s Intro to Drupal 7: Theming Fields and Nodes with Templates: http://youtu.be/sxZQqgvJk3s

Más contenido relacionado

Destacado

ооо «бизнесстрой»
ооо «бизнесстрой»ооо «бизнесстрой»
ооо «бизнесстрой»
Aleksandr Tsurikov
 

Destacado (17)

Nov. 2
Nov. 2Nov. 2
Nov. 2
 
тренинг в оаэ
тренинг в оаэтренинг в оаэ
тренинг в оаэ
 
Oct. 19
Oct. 19Oct. 19
Oct. 19
 
Feb. 8
Feb. 8Feb. 8
Feb. 8
 
January 11 Meeting
January 11 MeetingJanuary 11 Meeting
January 11 Meeting
 
Verbesserung der Code-"Qualität" durch statische Code-Analyse
Verbesserung der Code-"Qualität" durch statische Code-AnalyseVerbesserung der Code-"Qualität" durch statische Code-Analyse
Verbesserung der Code-"Qualität" durch statische Code-Analyse
 
sqlparse Lightning Talk
sqlparse Lightning Talksqlparse Lightning Talk
sqlparse Lightning Talk
 
Over The Years With Michelle
Over The Years With  MichelleOver The Years With  Michelle
Over The Years With Michelle
 
Accusative
AccusativeAccusative
Accusative
 
Grissy
GrissyGrissy
Grissy
 
ооо «бизнесстрой»
ооо «бизнесстрой»ооо «бизнесстрой»
ооо «бизнесстрой»
 
Django rest framework in 20 minuten
Django rest framework in 20 minutenDjango rest framework in 20 minuten
Django rest framework in 20 minuten
 
Caminos cruzados Kozak Kriscautzky (1994)
Caminos cruzados Kozak Kriscautzky (1994)Caminos cruzados Kozak Kriscautzky (1994)
Caminos cruzados Kozak Kriscautzky (1994)
 
Мой 95 регион
Мой 95 регионМой 95 регион
Мой 95 регион
 
Webbrowser-Automatisierung mit Python und Selenium WebDriver
Webbrowser-Automatisierung mit Python und Selenium WebDriverWebbrowser-Automatisierung mit Python und Selenium WebDriver
Webbrowser-Automatisierung mit Python und Selenium WebDriver
 
Fashion world
Fashion worldFashion world
Fashion world
 
Paparan p suyadi di batam
Paparan p suyadi di batamPaparan p suyadi di batam
Paparan p suyadi di batam
 

Similar a Creating and Theming Custom Content Types

CustomizingStyleSheetsForHTMLOutputs
CustomizingStyleSheetsForHTMLOutputsCustomizingStyleSheetsForHTMLOutputs
CustomizingStyleSheetsForHTMLOutputs
Suite Solutions
 
RPE - Template formating, style and stylesheet usage
RPE - Template formating, style and stylesheet usageRPE - Template formating, style and stylesheet usage
RPE - Template formating, style and stylesheet usage
GEBS Reporting
 
Z04 etano template_basics
Z04 etano template_basicsZ04 etano template_basics
Z04 etano template_basics
Daouni Monsite
 
Theming tips and tricks
Theming tips and tricksTheming tips and tricks
Theming tips and tricks
aaroncouch
 
Drupalcamp Atlanta 2010 Design-to-Theme
Drupalcamp Atlanta 2010 Design-to-ThemeDrupalcamp Atlanta 2010 Design-to-Theme
Drupalcamp Atlanta 2010 Design-to-Theme
Mediacurrent
 
Theming Drupal: Beyond the Look and Feel
Theming Drupal: Beyond the Look and FeelTheming Drupal: Beyond the Look and Feel
Theming Drupal: Beyond the Look and Feel
Chris Albrecht
 

Similar a Creating and Theming Custom Content Types (20)

Drupal 7 theme by ayushi infotech
Drupal 7 theme by ayushi infotechDrupal 7 theme by ayushi infotech
Drupal 7 theme by ayushi infotech
 
CustomizingStyleSheetsForHTMLOutputs
CustomizingStyleSheetsForHTMLOutputsCustomizingStyleSheetsForHTMLOutputs
CustomizingStyleSheetsForHTMLOutputs
 
RPE - Template formating, style and stylesheet usage
RPE - Template formating, style and stylesheet usageRPE - Template formating, style and stylesheet usage
RPE - Template formating, style and stylesheet usage
 
Custom WordPress theme development
Custom WordPress theme developmentCustom WordPress theme development
Custom WordPress theme development
 
Drupal theming
Drupal themingDrupal theming
Drupal theming
 
Drupal theme development
Drupal theme developmentDrupal theme development
Drupal theme development
 
Marky Markup and the Funky Bunch
Marky Markup and the Funky BunchMarky Markup and the Funky Bunch
Marky Markup and the Funky Bunch
 
Drupal Theme Development
Drupal Theme DevelopmentDrupal Theme Development
Drupal Theme Development
 
Z04 etano template_basics
Z04 etano template_basicsZ04 etano template_basics
Z04 etano template_basics
 
WordPress as a CMS v2
WordPress as a CMS v2WordPress as a CMS v2
WordPress as a CMS v2
 
Html & CSS - Best practices 2-hour-workshop
Html & CSS - Best practices 2-hour-workshopHtml & CSS - Best practices 2-hour-workshop
Html & CSS - Best practices 2-hour-workshop
 
Theming tips and tricks
Theming tips and tricksTheming tips and tricks
Theming tips and tricks
 
Drupalcamp Atlanta 2010 Design-to-Theme
Drupalcamp Atlanta 2010 Design-to-ThemeDrupalcamp Atlanta 2010 Design-to-Theme
Drupalcamp Atlanta 2010 Design-to-Theme
 
Drupal - Introduction to Drupal Creating Modules
Drupal - Introduction to Drupal Creating ModulesDrupal - Introduction to Drupal Creating Modules
Drupal - Introduction to Drupal Creating Modules
 
WordPress as a CMS
WordPress as a CMSWordPress as a CMS
WordPress as a CMS
 
WordPress Theming 101
WordPress Theming 101WordPress Theming 101
WordPress Theming 101
 
Drupal Themes
Drupal ThemesDrupal Themes
Drupal Themes
 
Theming Drupal: Beyond the Look and Feel
Theming Drupal: Beyond the Look and FeelTheming Drupal: Beyond the Look and Feel
Theming Drupal: Beyond the Look and Feel
 
Design to Theme @ CMSExpo
Design to Theme @ CMSExpoDesign to Theme @ CMSExpo
Design to Theme @ CMSExpo
 
Project 02 Creating and Editing a Web Page - Notes
Project 02 Creating and Editing a Web Page - NotesProject 02 Creating and Editing a Web Page - Notes
Project 02 Creating and Editing a Web Page - Notes
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 

Creating and Theming Custom Content Types

  • 1. Creating and Theming Custom Content Types Heather Rodriguez UMD Drupal Users Group October 5th, 2011
  • 2. What is a Content Type? Node: the most basic unit of content Made up of fields of information (ex. Title, Body, URL, etc.) Nodes belong to content types based on fields they share in common Default content types: article (news), blog entry, basic page, book page, forum and poll
  • 3. Why Create Custom Content Types? Easily and quickly create new nodes that will collect and display the same fields of information Images File upload Text fields Teasers Links etc.
  • 4. Custom Content Type Example Faculty Bios Name Department Areas of Expertise Research Projects Contact Information Educational background
  • 5. Customizing Content Types through Template Overrides Copy the content of node template (/sites/all/theme/node.tpl.php)into a blank file Save as node--your-content-type.tpl.php into the templates folder to override the default node template Two dashes after node for Drupal 7, 1 for 6 You MUST FOLLOW this naming convention Double-check the machine name of your content type
  • 6. Customizing Content Types (cont.) Expose array names for styling <?phpprint_r(array_keys($content)) ?>include Print the arrays that you need to display on the page <?php print render($content [’arraynamehere']) ?> Add your HTML and CSS around the arrays <h3><?php print render($content [’arraynamehere']) ?></h3> or <p class=“paragraphstyle”><?php print render($content[‘arraynamehere’]) ?></p>
  • 7. Flush the Theme Cache! In order to see the effects of your styling, you must empty your theme cache! Configuration > Performance > Clear all caches
  • 8. Customizing Fields To modify a specific field rather than the entire content type (useful for separating field label from field items): Make a new copy of the field template file (field.tpl.php located in Modules < Field < Theme) and put it into your theme’s template folder (Sites < All < Themes <Templates) Put your HTML and CSS around the field label or items, depending on what you want to modify Save file as field-- field_machinename.tpl.php
  • 9. Tips You can use these same methods of template overrides for Views, Forms, Pages, etc. as well For a full list of possible tpl.php overrides, check out Drupal 7 Template Suggestions: http://drupal.org/node/1089656 Don’t forget to save template overrides in your theme folder! If you don’t see any changes, flush the theme cache. Watch Lin Clark’s Intro to Drupal 7: Theming Fields and Nodes with Templates: http://youtu.be/sxZQqgvJk3s