create account

How do I use template inheritance in QUIQQER? by pcsg-dev

View this thread on: hive.blogpeakd.comecency.com
· @pcsg-dev ·
$18.69
How do I use template inheritance in QUIQQER?
How do I use template inheritance in QUIQQER?
======

<center>
![](https://steemitimages.com/640x0/https://github.com/QUIQQER/QUIQQER/raw/master/bin/images/Readme.png)
</center>

In version 1.3 QUIQQER appears with the possibility of template inheritance. Through template inheritance you are now able to inherit your created template from another template.

You are now able to overwrite individual parts / blocks of the parent template in your own template package. If the child template does not have certain HTML / CSS files, these are obtained from the parent template. So you don't have to start templates from scratch.

#### Repository

- https://github.com/quiqqer

#### What Will I Learn?

In this tutorial we will show you how to quickly create a template using the new inheritance in QUIQQER 1.3. As described in the [last post](https://steemit.com/utopian-io/@pcsg-dev/quiqqer-template-inheritance) we have implemented a template inheritance which allows you to specify a kind of parent template for your template.

#### Requirements

- You need a QUIQQER System
- You need a new QUIQQER Package
- You need to know from which Template you want to inherit
- The parent template should include Asset URL's with `{$Template->getTemplateUrl('URL')}`and should uses `{fetch}` to include HTML files.
- You need to know whats a `composer.json` file is

#### Difficulty

- Intermediate

#### Tutorial Contents

I assume that your package is available and that you have created the first files for your package. This means you have a `composer.json` file and a `package.xml`.

If not then please create this, if yes, then we will start now.


**First of all** you have to define your dependency in your `composer.json` so that the parent template is available in the system. If you want to inherit from `quiqqer/template-cologne`, you have to add this template to the require part of the package `composer.json file`. 

In this tutorial I assume that we want `quiqqer/template-cologne` as a dependency. This is a quite complicated template and shows super that small parts can be overwritten even in complicated templates quickly and easily.

```
"require": {
    "quiqqer/template-cologne": "1.*|dev-master|dev-dev"
}
```

A complete `composer.json` could look something like this:
<center>
![composer-json.png](https://cdn.steemitimages.com/DQmUu8mkC9qs68VMMEVdr6G83anGPRX5HwLDbqYV8bjK5q6/composer-json.png)
</center>

After that you have to tell your template package that it has a parent template. You do this in the `package.xml` of your package by adding a `<template_parent>` entry.

A complete `package.xml` could look something like this:
<center>
![package.png](https://cdn.steemitimages.com/DQmRnnVponyrLRrWUojrY2wTXKYQX7j6DH9zRxJMTcr1M54/package.png)
</center>

Once these two things are done, you can start overwriting the templates. So that you can overwrite individual files of the parent template, you only have to create the same folder structure as in your source template.

So that you know which things you can overwrite in the template there are two ways. The developer has documented this or you can see for yourself which areas can be overwritten.

Most of the time the documentation is a bit incomplete, so you should have a look at the Parent Template.
For example, what you need to pay attention are all {fetch} functions in HTML. The Smarty `{fetch}` function inserts another HTML template exactly at this point.

In the Cologne Template, for example, there are the following code lines:
<center>
![footer-html.png](https://cdn.steemitimages.com/DQmUKgVi2N8B3QGB5vsvJBn7fSBokJ524LCz7tt2JyZ8yHn/footer-html.png)
</center>

If we now want to customize the template `footerCopyright.html` for us, we just have to create a template folder and a new HTML file called `footerCopyright.html`. Now we can write everything we want into it.

Of course, we prepared the whole thing to show you what it looks like. Examples always clarify the whole thing a lot better. (https://github.com/QUIQQER/template-inheritance-example/tree/master/template)

From now on you can overwrite templates and quickly offer completely new templates. Look forward to more tutorials in the near future. We will explain to you how to build your e-commerce shop or your SaaS quickly and easily.

#### Curriculum

- *More coming soon* ;-)

#### Proof of Work Done

- https://github.com/QUIQQER/template-inheritance-example


We wish you a lot of fun with QUIQQER

Thanks for reading,
Hen, for PCSG Developers
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 14 others
properties (23)
authorpcsg-dev
permlinkhow-do-i-use-template-inheritance-in-quiqqer
categoryutopian-io
json_metadata{"tags":["utopian-io","tutorials"],"image":["https://steemitimages.com/640x0/https://github.com/QUIQQER/QUIQQER/raw/master/bin/images/Readme.png","https://cdn.steemitimages.com/DQmUu8mkC9qs68VMMEVdr6G83anGPRX5HwLDbqYV8bjK5q6/composer-json.png","https://cdn.steemitimages.com/DQmRnnVponyrLRrWUojrY2wTXKYQX7j6DH9zRxJMTcr1M54/package.png","https://cdn.steemitimages.com/DQmUKgVi2N8B3QGB5vsvJBn7fSBokJ524LCz7tt2JyZ8yHn/footer-html.png"],"links":["https://github.com/quiqqer","https://steemit.com/utopian-io/@pcsg-dev/quiqqer-template-inheritance","https://github.com/QUIQQER/template-inheritance-example/tree/master/template","https://github.com/QUIQQER/template-inheritance-example"],"app":"steemit/0.1","format":"markdown"}
created2019-04-04 18:33:12
last_update2019-04-04 18:33:12
depth0
children4
last_payout2019-04-11 18:33:12
cashout_time1969-12-31 23:59:59
total_payout_value14.210 HBD
curator_payout_value4.480 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length4,504
author_reputation41,490,075,306,333
root_title"How do I use template inheritance in QUIQQER?"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id82,491,004
net_rshares26,597,706,236,726
author_curate_reward""
vote details (78)
@portugalcoin ·
$7.41
Thank you for your contribution @pcsg-dev.
After reviewing your tutorial we suggest the following points listed below:

- Your tutorial is quite short for a good tutorial. We recommend you aim for capturing at least 2-3 concepts.

- Code sections are better displayed using the code markup, instead of placing them as screenshots.

- We suggest that in your next tutorial details more what you have developed, so that the reader less experienced in programming understands well your contribution.

- We suggest that you put the result into an image of what was developed in this tutorial.

Thank you for your work in developing this tutorial.
Looking forward to your upcoming tutorials.

Your contribution has been evaluated according to [Utopian policies and guidelines](https://join.utopian.io/guidelines), as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, [click here](https://review.utopian.io/result/8/3-1-3-2-3-2-2-3-).

---- 
Need help? Chat with us on [Discord](https://discord.gg/uTyJkNm).

[[utopian-moderator]](https://join.utopian.io/)
πŸ‘  , , , , , , , , , , , , , , , , , , ,
properties (23)
authorportugalcoin
permlinkre-pcsg-dev-how-do-i-use-template-inheritance-in-quiqqer-20190404t213857019z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"users":["pcsg-dev"],"links":["https://join.utopian.io/guidelines","https://review.utopian.io/result/8/3-1-3-2-3-2-2-3-","https://discord.gg/uTyJkNm","https://join.utopian.io/"],"app":"steemit/0.1"}
created2019-04-04 21:38:57
last_update2019-04-04 21:38:57
depth1
children1
last_payout2019-04-11 21:38:57
cashout_time1969-12-31 23:59:59
total_payout_value5.643 HBD
curator_payout_value1.769 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,138
author_reputation599,458,605,033,115
root_title"How do I use template inheritance in QUIQQER?"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id82,497,254
net_rshares10,613,117,388,707
author_curate_reward""
vote details (20)
@utopian-io ·
Thank you for your review, @portugalcoin! Keep up the good work!
properties (22)
authorutopian-io
permlinkre-re-pcsg-dev-how-do-i-use-template-inheritance-in-quiqqer-20190404t213857019z-20190407t012249z
categoryutopian-io
json_metadata"{"app": "beem/0.20.17"}"
created2019-04-07 01:22:51
last_update2019-04-07 01:22:51
depth2
children0
last_payout2019-04-14 01:22:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length64
author_reputation152,955,367,999,756
root_title"How do I use template inheritance in QUIQQER?"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id82,608,330
net_rshares0
@steem-ua ·
#### Hi @pcsg-dev!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
**Feel free to join our [@steem-ua Discord server](https://discord.gg/KpBNYGz)**
πŸ‘  
properties (23)
authorsteem-ua
permlinkre-how-do-i-use-template-inheritance-in-quiqqer-20190404t222121z
categoryutopian-io
json_metadata"{"app": "beem/0.20.19"}"
created2019-04-04 22:21:21
last_update2019-04-04 22:21:21
depth1
children0
last_payout2019-04-11 22:21:21
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length287
author_reputation23,214,230,978,060
root_title"How do I use template inheritance in QUIQQER?"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id82,498,511
net_rshares33,671,919
author_curate_reward""
vote details (1)
@utopian-io ·
Hey, @pcsg-dev!

**Thanks for contributing on Utopian**.
We’re already looking forward to your next contribution!

**Get higher incentives and support Utopian.io!**
 Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via [SteemPlus](https://chrome.google.com/webstore/detail/steemplus/mjbkjgcplmaneajhcbegoffkedeankaj?hl=en) or [Steeditor](https://steeditor.app)).

**Want to chat? Join us on Discord https://discord.gg/h52nFrV.**

<a href='https://steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1'>Vote for Utopian Witness!</a>
properties (22)
authorutopian-io
permlinkre-how-do-i-use-template-inheritance-in-quiqqer-20190405t054521z
categoryutopian-io
json_metadata"{"app": "beem/0.20.17"}"
created2019-04-05 05:45:24
last_update2019-04-05 05:45:24
depth1
children0
last_payout2019-04-12 05:45:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length590
author_reputation152,955,367,999,756
root_title"How do I use template inheritance in QUIQQER?"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id82,514,127
net_rshares0