Help:Class: Difference between revisions

2 bytes removed ,  24 October 2024
(→‎Options: expand)
(→‎Options: expand)
Line 101: Line 101:
*Sections - This...
*Sections - This...


===Options===  
===Options===


*This template can be included multiple times on the page - This feature  leverages MediaWiki's templating system to iteratively display data stored via Cargo, enhancing the dynamic and flexible presentation of information stored in a structured manner within the wiki.
==== This template can be included multiple times on the page ====
** Data Repetition: Cargo allows for storing structured data in MediaWiki pages. When you create templates to display this data, you might want to use the same template structure to show different sets of data. For example, if you have a template for displaying book information, you might want to use that template multiple times on one page to list several books.
This feature  leverages MediaWiki's templating system to iteratively display data stored via Cargo, enhancing the dynamic and flexible presentation of information stored in a structured manner within the wiki.
** No Conflict in Data Display: Each instance of the template should be able to pull and display different data sets without the instances interfering with each other. This means:
* Data Repetition: Cargo allows for storing structured data in MediaWiki pages. When you create templates to display this data, you might want to use the same template structure to show different sets of data. For example, if you have a template for displaying book information, you might want to use that template multiple times on one page to list several books.
*** Unique Identifiers: If the template generates or uses any HTML IDs or JavaScript variables, they need to be unique for each instance to avoid conflicts in the DOM or in scripts.
* No Conflict in Data Display: Each instance of the template should be able to pull and display different data sets without the instances interfering with each other. This means:
*** Data Parameters: The template should be designed to accept parameters or use Cargo queries that can specify which piece of data (or which set of data) it should display each time it's called.
** Unique Identifiers: If the template generates or uses any HTML IDs or JavaScript variables, they need to be unique for each instance to avoid conflicts in the DOM or in scripts.
** Dynamic Content Handling: Since Cargo often involves querying data from wiki pages or databases:
** Data Parameters: The template should be designed to accept parameters or use Cargo queries that can specify which piece of data (or which set of data) it should display each time it's called.
*** Each template call might query different data. If the template uses #cargo_query, each instance can define different parameters for what data to fetch, allowing for different content in each template instance.
* Dynamic Content Handling: Since Cargo often involves querying data from wiki pages or databases:
*** Scope of Variables: Variables used within the template for storing or manipulating data should not leak or overwrite each other between different template instances.
** Each template call might query different data. If the template uses #cargo_query, each instance can define different parameters for what data to fetch, allowing for different content in each template instance.
** Efficiency: Even though templates can be included multiple times, there should be considerations for:
** Scope of Variables: Variables used within the template for storing or manipulating data should not leak or overwrite each other between different template instances.
*** Page Load Time: Multiple queries or complex template processing might slow down page loading if not optimized.
* Efficiency: Even though templates can be included multiple times, there should be considerations for:
*** Cargo Query Optimization: Efficient use of Cargo's ability to limit, join, or filter data to reduce unnecessary database hits or compute overhead with each inclusion.
** Page Load Time: Multiple queries or complex template processing might slow down page loading if not optimized.
** Modular Design: Such templates are usually designed to be modular and reusable, meaning they:
** Cargo Query Optimization: Efficient use of Cargo's ability to limit, join, or filter data to reduce unnecessary database hits or compute overhead with each inclusion.
*** Are built with the idea that their content will change with each use, based on the parameters passed or the data queried.
* Modular Design: Such templates are usually designed to be modular and reusable, meaning they:
*** Maintain Consistency: While they can show different data, the format and style remain consistent, which is useful for maintaining a uniform look across different content on the same page.
** Are built with the idea that their content will change with each use, based on the parameters passed or the data queried.
** In practice, this capability allows wiki editors to:
** Maintain Consistency: While they can show different data, the format and style remain consistent, which is useful for maintaining a uniform look across different content on the same page.
*** Create lists or galleries where each item follows the same format but displays different data (e.g., a list of events, publications, personnel bios, etc.).
* In practice, this capability allows wiki editors to:
*** Implement dynamic content sections where each section might focus on different aspects of similar data, like different product features or specifications, all on the same wiki page.
** Create lists or galleries where each item follows the same format but displays different data (e.g., a list of events, publications, personnel bios, etc.).
*Use full wikitext instead of #template_display - You need to manually write out how you want template data to appear using MediaWiki's language, rather than relying on the automated or semi-automated display mechanisms provided by extensions like Cargo. This approach is chosen for greater control, customization, or when the display logic provided by extensions does not meet the specific needs or design requirements of the page.  
** Implement dynamic content sections where each section might focus on different aspects of similar data, like different product features or specifications, all on the same wiki page.
**The options are
 
*** #template_display: This would be a parser function or a similar mechanism provided by extensions like Cargo or Semantic MediaWiki to display template data in a more formatted or structured way. When you use something like #template_display, it implies you're leveraging the extension's capabilities to handle how the template's content is shown, potentially simplifying the wikitext and making use of predefined display formats like infoboxes, tables, etc.
==== Use full wikitext instead of #template_display ====
*** Full Wikitext: This means instead of relying on an extension's shorthand or parser functions to display data, you would write out the full wikitext yourself. This approach gives you complete control over how the information from templates is displayed. You're not using a pre-formatted display function provided by Cargo or another extension; instead, you're crafting how each piece of data from the template looks using standard MediaWiki markup. This could involve manually creating tables, divs, spans, and using inline styling or classes for layout and design.
You need to manually write out how you want template data to appear using MediaWiki's language, rather than relying on the automated or semi-automated display mechanisms provided by extensions like Cargo. This approach is chosen for greater control, customization, or when the display logic provided by extensions does not meet the specific needs or design requirements of the page.
**** Customization: You have the freedom to customize every aspect of how the data is presented. If you want a specific layout that's not easily achievable with the default settings of #template_display, you'd opt for full wikitext.
 
**** Complexity: It can be more complex and verbose because you're writing out all the formatting code instead of letting an extension handle it with simpler syntax.
The options are:
**** Learning Curve and Maintenance: It might require a better understanding of MediaWiki syntax and potentially could be harder to maintain if the structure of your data or the desired display format changes frequently.
 
**** Performance: On some wikis, avoiding complex parser functions for every template might lead to slightly better performance in terms of page rendering time, especially if the wiki has many such templates, since parser functions can sometimes be computationally heavier than straightforward wikitext.
===== #template_display =====
**** Compatibility: If there's a concern about compatibility with different extensions or future changes in how extensions handle template display, using full wikitext might ensure your pages look consistent regardless of changes in the extensions.
This would be a parser function or a similar mechanism provided by extensions like Cargo or Semantic MediaWiki to display template data in a more formatted or structured way. When you use something like #template_display, it implies you're leveraging the extension's capabilities to handle how the template's content is shown, potentially simplifying the wikitext and making use of predefined display formats like infoboxes, tables, etc.
 
===== Full Wikitext =====
This means instead of relying on an extension's shorthand or parser functions to display data, you would write out the full wikitext yourself. This approach gives you complete control over how the information from templates is displayed. You're not using a pre-formatted display function provided by Cargo or another extension; instead, you're crafting how each piece of data from the template looks using standard MediaWiki markup. This could involve manually creating tables, divs, spans, and using inline styling or classes for layout and design.
* Customization: You have the freedom to customize every aspect of how the data is presented. If you want a specific layout that's not easily achievable with the default settings of #template_display, you'd opt for full wikitext.
* Complexity: It can be more complex and verbose because you're writing out all the formatting code instead of letting an extension handle it with simpler syntax.
* Learning Curve and Maintenance: It might require a better understanding of MediaWiki syntax and potentially could be harder to maintain if the structure of your data or the desired display format changes frequently.
* Performance: On some wikis, avoiding complex parser functions for every template might lead to slightly better performance in terms of page rendering time, especially if the wiki has many such templates, since parser functions can sometimes be computationally heavier than straightforward wikitext.
* Compatibility: If there's a concern about compatibility with different extensions or future changes in how extensions handle template display, using full wikitext might ensure your pages look consistent regardless of changes in the extensions.


===Form name===
===Form name===