Question: How to do an include in DF Template System?
Post new topic   Reply to topic   Printer Friendly Page     Forum IndexAdd-Ons & Blocks
Author Message
layingback
Forum Admin


Joined: Apr 19, 2004
Posts: 953

PostPost subject: Question: How to do an include in DF Template System?
Posted: Mon Jul 27, 2009 7:45 am
Reply with quote

I have a common block of DF template HTML which I want to be present in many different output templates. Maintaining this common block of code in every template is too onerous, so is there a way to add an include (read-once) like call in a DF template, to incorporate the common code at runtime?

None of the general HTML include-like directives I found so far searching Google seem to work in the DF template system.

To place the question in context: I have generalised links for sharing to social network sites (now up to 42 different sites!), that wants to appear in any/every template.

TIA.

_________________
Pro_News: The complete module for Dragonfly - now available as version 3.3

layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
2.6 - 3.6 / 1.3.42 - 2.2.12 / 5.0.92 - 5.1.37 - 5.1.54 / 4.4.49 - 5.2.17 - 5.3 / 9.2.1
Back to top
View user's profile Visit poster's website
Phoenix
Site Admin


Joined: Apr 19, 2004
Posts: 8729
Location: Netizen

PostPost subject: Re: Question: How to do an include in DF Template System?
Posted: Mon Jul 27, 2009 10:42 am
Reply with quote

PHP:
<!-- INCLUDE module/whatever.html -->
You just need to ensure the whatever template variables are defined so they can be picked up wherever you use the include.

Including templates is common in forums.


Phoenix's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Back to top
View user's profile Visit poster's website
layingback
Forum Admin


Joined: Apr 19, 2004
Posts: 953

PostPost subject: Re: Question: How to do an include in DF Template System?
Posted: Thu May 06, 2010 7:59 am
Reply with quote

Phoenix wrote:
PHP:
<!-- INCLUDE module/whatever.html -->

The above works fine, and I've been using ever since, thanks. But I now have a user who wants to include the above on each article when > 1 articles are displayed on the page.

When used > 1 time on the page, the above works for just the FIRST article displayed, nothing is included for the following articles.

IOW, the INCLUDE seems to be equivalent to require_once, and I need require. Are there other forms of the above statement?

Is this stuff documented anywhere?

TIA!

_________________
Pro_News: The complete module for Dragonfly - now available as version 3.3

layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
2.6 - 3.6 / 1.3.42 - 2.2.12 / 5.0.92 - 5.1.37 - 5.1.54 / 4.4.49 - 5.2.17 - 5.3 / 9.2.1
Back to top
View user's profile Visit poster's website
greenday2k
Forum Admin


Joined: Aug 11, 2005
Posts: 484
Location: CO

PostPost subject: Re: Question: How to do an include in DF Template System?
Posted: Thu May 06, 2010 8:32 pm
Reply with quote

PHP:
<!-- PHP -->
# This is a hack since the template system includes files using the include_once() function instead
# of using the include() function.
global $cpgtpl;
$cpgtpl->set_filenames(array('pagination' => 'pagination.html'));
$cpgtpl->display('pagination', false);
<!--
ENDPHP -->

Source: ForumsPro.

_________________
www.greenday2k.net



greenday2k's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Back to top
View user's profile Visit poster's website MSN Messenger Yahoo Messenger
layingback
Forum Admin


Joined: Apr 19, 2004
Posts: 953

PostPost subject: Re: Question: How to do an include in DF Template System?
Posted: Thu May 06, 2010 8:59 pm
Reply with quote

Thanks!

Klunky - but it works! Smile

Would seem so easy to fix once and for all though - just change the default ...

Thanks again!

_________________
Pro_News: The complete module for Dragonfly - now available as version 3.3

layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
2.6 - 3.6 / 1.3.42 - 2.2.12 / 5.0.92 - 5.1.37 - 5.1.54 / 4.4.49 - 5.2.17 - 5.3 / 9.2.1
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   Printer Friendly Page     Forum IndexAdd-Ons & Blocks All times are GMT
Page 1 of 1


Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Dedicated Server & Bandwidth Sponsored by DedicatedNOW
User Info [x]

Welcome Anonymous

Nickname
Password
(Register)

Last CVS commits [x]

Languages [x]

Community [x]

Support for DragonflyCMS in a other languages:

Deutsch
Español

X-links [x]
UltraEdit Browse Happy logo Firefox MySQL PostgreSQL Valid CSS! Valid XHTML 1.0! Unicode Encoded Badge NukeBiz Resources Raven DragonflyCMS Dedicated Now InsideSupport Lampe Berger

Preview theme [x]
Each user can view the site with a different theme.
Themes marked with a * also change the forum look.


You are seeing squares or questionmarks on this page?

All content of this website is copyrighted by the Creative Commons NC-SA
The logos and trademarks used on this site are the property of their respective owners
We are not responsible for comments posted by our users, as they are the property of the poster.
Our server runs on a P3 1.2GHz with 512MB RAM with no accelerators
Support GoPHP5.org
This page generated in 0.3909 seconds with 16 DB Queries in 0.0809 seconds
Memory Usage: 2.9 MB
Interactive software released under GNU GPL, Code Credits, Privacy Policy