MODx Community Forums
The MODx Blog
Donations
Feedburner Feeds
Documentation
Bugs & Requests
The Wiki
download MODx
plugins, modules, snippets
online demo
Jul 03, 2009, 10:35 PM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search via SMF
or Google:
modx forums
all of modxcms.com
web
MODxCMS.com
Forums
Help
Login
Register
News
:Read what MODx Developers say:
MODx Dev. Blogs
MODx Community Forums
»
Development & Coding
»
Templates
»
Template as file
Pages: [
1
]
2
Go Down
« Previous topic
Next topic »
Print
Author
Topic: Template as file (Read 8968 times)
0 Members and 1 Guest are viewing this topic.
WijbaL
New Member
Posts: 1
Template as file
«
on:
Dec 24, 2006, 05:07 PM »
Is it posible to use template files instead of making templates in resources-templates?
it will be a lot easier to edit.
ive tried to include a snippet that includes my template and that works but is there a way to do it without snippets?
or any other tips
thx, WIjbaL
Logged
zi
MODx Special Forces /
Administrator
Posts: 3,329
May Peace Be On You
Re: Template as file
«
Reply #1 on:
Dec 25, 2006, 09:18 AM »
AFAIK, I think snippets are the only way to include php scripts.
Logged
Subscribe to
MODx Commercial Support Plans
Share and Explore websites made in MODx
--------------------------------------------------
Follow me on Twitter
My Blog
,
Resource Center
ziworks | Custom/Free MODx Templates
chodorowicz
Jr. Member
Posts: 12
Re: Template as file
«
Reply #2 on:
Mar 20, 2007, 01:18 PM »
I just wanted to ask if anything changed in this issue, that is what's the best way to include a template from a file
editing template in modx manager isnt so convenient and copy&paste method gets really tiresome
thanks for the answer in advance and thanks for such a wonder which modx surely is - it's awesome project
greets!
Logged
ER
Full Member
Posts: 150
Re: Template as file
«
Reply #3 on:
Mar 20, 2007, 02:13 PM »
This is completely possible. Here's how you do it...
Create a Snippet called includeFile and copy-n-paste in this code:
Code:
<?php
# Snippet to include files from filesystem
# [[includeFile? &file=`assets/templates/mytemplate/file.html`]]
if ( !isset(
$file
) ||
$file
==
""
) return
"No file specified."
;
//check if there's a file given.
//Start the buffer
ob_start
();
//include
include
$file
;
//get contents from the buffer
$ob_contents
=
ob_get_contents
();
//and kill/delete the buffer
ob_end_clean
();
//return it to MODx
return
$ob_contents
;
?>
Once you save that, make a new Template or edit your existing template. Erase any Template code you have in there and paste in this call to the includeFile Snippet you just created:
Code:
[[includeFile? &file=`assets/templates/YourTemplateName/YourTemplateHTMLFile.html`]]
I took this from the code I found in the Molio templates. It works perfectly for me. I hate having to always paste in my new HTML code after I edit it on my local machine.
Cheers!
Logged
chodorowicz
Jr. Member
Posts: 12
Re: Template as file
«
Reply #4 on:
Mar 20, 2007, 02:53 PM »
many thanks, works perfectly
Logged
Sylvaticus
Sr. Member
Posts: 428
I think, therefor I am. But what I am, and why...?
Re: Template as file
«
Reply #5 on:
Mar 21, 2007, 06:13 AM »
This looks great. A question: Do you then have an auto-transfer of your html-template-file? Or how do you do this? To make this efficient, i mean?
Logged
ER
Full Member
Posts: 150
Re: Template as file
«
Reply #6 on:
Mar 21, 2007, 07:32 AM »
Well, my workflow is this:
1) Edit HTML in Dreamweaver on my local machine.
2) Upload the HTML file(s) within Dreamweaver's FTP function to the live site.
I imagine a lot of web developers/designers work this way, so that's why editing the HTML within MODx's template page is such a pain. Even if you don't have Dreamweaver, it's just as easy to drag-n-drop the files over to the live site through any FTP client.
Another way I work is actually even easier for me. I'm on a Mac and I use YummyFTP. With that FTP client, I can find the file on the live site that I want to edit, then click on the editor button and it downloads the file to my editor of choice (TextMate), I make my edits and when I hit save, YummyFTP automatically uploads the saved file back to my live site. I do this when I'm making small changes since I don't use TextMate fulltime (yet).
So you can see there's lots of options for you to make this as efficient as possible.
Logged
rthrash
Foundation
Posts: 10,471
Re: Template as file
«
Reply #7 on:
Mar 21, 2007, 07:45 AM »
I use the same technique with Textmate and Transmit er16004. I think you'll reallly like what the future has in store.
Logged
MODx
is a framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Community participation and questions are encouraged, especially when you
help us help you
,
read the wiki
, and review snippet parameters even if you have to look at the source. Searching the forums helps, too.
Ryan Thrash
MODx Co-Founder
Principal @
Collabpad
work
productively.
work
intelligently.
work
together.
MODx
Current
|
Dev
|
SVN Root
|
JIRA (Bugs)
|
Confluence (Revolution Wiki)
|
Fisheye SVN Browser
Whitefen
Full Member
Posts: 128
Re: Template as file
«
Reply #8 on:
Mar 28, 2007, 05:55 AM »
For anyone interested in other Mac software options...
Most of the major Mac FTP clients integrate with BBEdit using the same kind of direct integration as you mentioned with YummyFTP and TextMate.
This system works very efficiently for me.
«
Last Edit: Mar 28, 2007, 06:01 AM by Whitefen
»
Logged
"Regret for the things we did can be tempered by time; it is regret for the things we did not do that is inconsolable."
-- Sydney Harris
ER
Full Member
Posts: 150
Re: Template as file
«
Reply #9 on:
Mar 28, 2007, 07:48 AM »
"...And I'm a PC":
FileZilla for FTP:
http://sourceforge.net/projects/filezilla
EditPadLite for editing text (better than Notepad):
http://www.editpadlite.com/
Both of these are free and can do what we're talking about on the Mac... but with less fun.
Logged
sottwell
Documentation Team
Posts: 8,827
Re: Template as file
«
Reply #10 on:
Mar 28, 2007, 08:32 AM »
SubEthaEdit is really fancy, not only do the major ftp clients use it for a default editor (I use Cyberduck) but it also has multiple editor collaboration over either local networks or the Internet, using "Bonjour". Different color highlighing for what the other editors are doing, in real-time. But it's not free any more. So I started using Smultron, which pretty much does the same thing without the collaboration. I still prefer SubEthaEdit's layout, though.
Logged
sottwell.com has moved to a lovely Solaris 10 server!
Log in
username guest, password guestuser.
Templates are now becoming available at
http://sottwell.com/templates.html
rthrash
Foundation
Posts: 10,471
Re: Template as file
«
Reply #11 on:
Mar 28, 2007, 08:36 AM »
I've used SubEthaEdit's collaboration feature at a conference and it's incredibly cool.
Logged
MODx
is a framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Community participation and questions are encouraged, especially when you
help us help you
,
read the wiki
, and review snippet parameters even if you have to look at the source. Searching the forums helps, too.
Ryan Thrash
MODx Co-Founder
Principal @
Collabpad
work
productively.
work
intelligently.
work
together.
MODx
Current
|
Dev
|
SVN Root
|
JIRA (Bugs)
|
Confluence (Revolution Wiki)
|
Fisheye SVN Browser
myfriendscallmebill
Member
Posts: 90
Re: Template as file
«
Reply #12 on:
Mar 29, 2007, 12:22 AM »
Quote from: WijbaL on Dec 24, 2006, 05:07 PM
Is it posible to use template files instead of making templates in resources-templates?
Name your template file "myTemplate.html"
Place it in "/assets/templates/myTemplate.html"
Create a template variable named "templateTV"
Make it's input type = "file"
make it's default value = "@FILE assets/templates/myTemplate.html"
Create a document template named "myTemplate"
Go back to the template variable and make it available to this template.
Then return to this template and set its contents to "[*templateTV*]"
Create a MODx document.
Set its template to "myTemplate".
Now you can edit your template file in Dreamweaver, etc. then upload it to /assets/templates/myTemplate.html, and when you refresh your MODx document you'll see your changes.
Is that what you wanted?
«
Last Edit: Mar 29, 2007, 12:26 AM by myfriendscallmebill
»
Logged
jorgerpo
Jr. Member
Posts: 11
Re: Template as file
«
Reply #13 on:
Oct 10, 2008, 03:01 PM »
which of the 2 methods is faster?
are there any drawbacks??
Logged
Kristalin
Hello World
Moderators
Posts: 130
Memento vivere
Re: Template as file
«
Reply #14 on:
Oct 10, 2008, 04:11 PM »
Quote from: myfriendscallmebill on Mar 29, 2007, 12:22 AM
Quote from: WijbaL on Dec 24, 2006, 05:07 PM
Is it posible to use template files instead of making templates in resources-templates?
Name your template file "myTemplate.html"
Place it in "/assets/templates/myTemplate.html"
Create a template variable named "templateTV"
Make it's input type = "file"
make it's default value = "@FILE assets/templates/myTemplate.html"
Create a document template named "myTemplate"
Go back to the template variable and make it available to this template.
Then return to this template and set its contents to "[*templateTV*]"
Create a MODx document.
Set its template to "myTemplate".
Now you can edit your template file in Dreamweaver, etc. then upload it to /assets/templates/myTemplate.html, and when you refresh your MODx document you'll see your changes.
Is that what you wanted?
GREAT!
I use EditPlus
- > FTP - >Open Remote
NEW: i thing documents using this template must be NOT Cacheable!
«
Last Edit: Oct 14, 2008, 03:58 AM by Kristalin
»
Logged
be KiVi, be gReen
Pages: [
1
]
2
Go Up
Print
« Previous topic
Next topic »
Jump to:
Please select a destination:
-----------------------------
Announcements
-----------------------------
=> Important News
=> Security Notices
-----------------------------
Commercial Support
-----------------------------
=> [CS] About Commercial Support
-----------------------------
Development & Coding
-----------------------------
=> Commercial Inquiries & Bounties
=> Core Code
===> MODx Next
===> xPDO
=> Module, Plugin & Snippet Creation and Modification
=> In Development
=> Templates
-----------------------------
Add-ons, Extensions & Elements
-----------------------------
=> Module, Plugin & Snippet Usage
=> General Repository Items Support
=> Navigation & Tagging/Taxonomy
===> Wayfinder & DropMenu
=> Creating & Repurposing Content
===> Ditto
===> Jot
===> Front-end Document Management
=> Users, Authentication & Personalization
===> WebloginPE
===> WebLogin, WebSignup and WebChangePwd
=> Rich Text Editors & File Browser
===> TinyMCE
===> FCKeditor
===> MCPuck File Browser
=> Forms, Form Processing & Anti-Spam
===> eForm
=> Search
===> AjaxSearch
=> E-business
=> Polls, Calendars, Address Book and Community
=> Third-party integrations
=> Images, Videos & Podcasts
===> MaxiGallery
=> Manager, Parser & the Core
===> Backup & Versioning
===> Doc Finder
===> ManagerManager
===> PHx
=> Templates
-----------------------------
Support
-----------------------------
=> Release Support
===> 0.9.6.3
===> 0.9.6.2
===> 0.9.6.1
===> 0.9.6
===> 0.9.5 and earlier
=> General Support
===> MODx 101
===> E-Commerce, E-Marketing, Analytics & SEO
===> Hosting Experiences
===> IIS / Windows Hosting Issues
=> Documentation, Tips & Tricks
===> Documentation Suggestions & Corrections
-----------------------------
General Discussions
-----------------------------
=> General MODx Discussions
=> Webworker Lounge
=> Wishlist
=> You and Your Sites
=> modxcms.com Discussions and Suggestions
=> Off-topic
-----------------------------
International Support & Translations
-----------------------------
=> Internationalization
=> Bulgarian
===> Поддръжка
=====> Често задавани въпроси
=====> Инсталация
=====> Модули, Плъгини, Снипети и код
=====> Дизайн и Шаблони
===> Документация, Ръководства и Превод
=====> Документация
=====> Ръководства
=====> Превод
===> Общество
=====> Съобщения
=====> Представете се
=====> Представете сайта си
=====> Дискусии извън MODx
=> Chinese
=> Czech
===> Oznámení
=====> Důleitá oznámení/novinky
=====> Bezpečnost
===> Komunita
=====> Oznámení
=====> Představte se, prosím
=====> Ukázky práce
=====> Různé aneb cokoli co se jinam nehodí
===> Podpora
=====> FAQ (často kladené otázky)
=====> Instalace
=====> Moduly, pluginy, "snippets & code" (ablony zdrojových kódů)
=====> Design & ablony
===> Dokumentace, tutoriály (návody) a překlady
=====> Dokumentace
=====> Tutoriály (návody)
=====> Překlady (lokalizace)
=> Dutch
===> Ondersteuning
=====> Veel gestelde vragen
=====> Modules, Plugins, Snippets & Code
=====> Design & Templates
===> Documentatie, Tutorials en Vertalingen
=====> Documentatie
=====> Tutorials
=====> Vertalingen
===> Community
=====> Aankondigingen
=====> Stel jezelf voor
=====> Site Showcase
=====> De stamkroeg
=> Filipino
===> Suporta
=====> Kadalasang tanong
=====> Instalasyon
=====> Moduler, Maidadagdag, Karagdagang mga Code
=====> Desenyo at Templates
===> Dokumentasyon, Mga Turo, Mga Salin
=====> Dokumentasyon
=====> Mga Turo
=====> Mga Salin
===> Kumunidad
=====> Anunsyo
=====> Ipakilala ang sarili
=====> Ang Galing ng pinoy
=====> Tsismisan atbp
=> Finnish
===> Tuki
=====> UKK
=====> Asennus
=====> Moduulit, liitännäiset, koodinpätkät
=====> Ulkoasu/Sivustopohjat
===> Dokumentaatio, oppaat ja käännökset
=====> Dokumentaatio
=====> Käännökset
=====> Oppaat
===> Yhteisö
=====> Tiedotteet
=====> Esittele itsesi
=====> MODx sivustosi
=====> Kahvihuone
=> French
===> Support
=====> FAQ
=====> Installation
=====> Module, plugin, snippets
=====> Design/Templates
===> Documentation, Tutoriels et Traductions
=====> Documentation
=====> Traduction
=====> Tutoriels
===> Communauté
=====> Annonces
=====> Présentez vous
=====> Vos sites
=====> Le Bistrot Français
=> German
===> Support (de)
=====> FAQ (de)
=====> Installation (de)
=====> Module, Plugins, Snippets & Code (de)
=====> Design & Templates (de)
===> Dokumentation, Tutorials und Übersetzung
=====> Dokumentation
=====> Tutorials (de)
=====> Übersetzung
===> Community (de)
=====> Ankündigungen
=====> Stellt Euch vor
=====> Beispielseiten
=====> Off Topic / Verschiedenes
=> Hebrew
===> הכרזה
=====> חדשות חשובות
=====> אבטחה
===> תמיכה
=====> התקנה
=====> תיעוד, מדריכים ותרגומים
=====> עיצוב ותבניות
=====> שאלות נפוצות
===> תיעוד, מדריכים ותרגומים
=====> תיעוד
=====> מדריכים
=====> תרגומים
===> קהילה
=====> הודעות
=====> הצג את עצמך
=====> אתרים לדוגמא
=====> כללי
=> Irish
=> Italian
===> Supporto
=====> FAQ
=====> Installazione
=====> Moduli, Plugin, Snippet e altro codice
=====> Web Design e Template
===> Documentazione, Tutorial e Traduzione
=====> Documentazione
=====> Tutorial
=====> Traduzione
===> Comunitŕ
=====> Annunci
=====> Presentazioni
=====> Siti in vetrina
=====> Chiacchiere in libertŕ
=> Japanese
===> サポート
=====> 良くある質問
=====> インストール
=====> モジュール・プラグイン・スニペット・本体
=====> デザインやテンプレート
===> マニュアル・テュートリアル・翻訳
=====> マニュアル
=====> 事例集、テュートリアル
=====> 日本語化
===> コミュニティ
=====> お知らせ
=====> MODxサイト展示場
=====> 自己紹介
=====> 雑談
=====> 国産リソース
=> Persian - فارسي
===> پشتيباني
=====> راهنما
=====> نصب
=====> ماژول , پلاگین ها , کد ها و جزییات
=====> طراحی و قالب ها
===> مستند سازی , آموزش ها و ترجمه ها
=====> مستند سازی
=====> آموزش ها
=====> ترجمه ها
===> انجمن ها
=====> اخبار
=====> معرفی کردن خود
=====> نمایش دادن سایت ها
=====> بحث های عمومی و سایر موضوعات
=> Polish
===> Wsparcie
=====> FAQ
=====> Instalacja
=====> Moduły, pluginy, snipety i kod
=====> Wygląd i szablony
===> Dokumentacja, tutoriale i tłumaczenie
=====> Dokumentacja
=====> Tutoriale
=====> Tłumaczenie
===> Społeczność
=====> Ogłoszenia
=====> Przedstaw się
=====> Twój serwis WWW
=====> Hyde Park
=> Portuguese
===> Suporte
=====> FAQ - Dúvidas Frequentes
=====> Instalaçăo
=====> Módulos, Plugins, Snippets e Código
=====> Design e Templates
===> Documentaçăo, Guias e Traduçőes
=====> Documentaçăo
=====> Guias
=====> Traduçőes
===> Comunidade
=====> Anúncios
=====> Apresente-se!
=====> Bar da esquina (fora de tópico)
=====> Portfólio de Sites
=> Russian
===> Поддержка
=====> ЧАВО (FAQ)
=====> Установка
=====> Модули, плагины, сниппеты и код
=====> Дизайны и шаблоны
===> Документация, Уроки, Перевод
=====> Документация
=====> Уроки
=====> Перевод
===> Сообщество
=====> Объявления
=====> Представьтесь публике
=====> Галерея сайтов
=====> Диван
=> Scandanavian
===> Support
=====> Frĺgor och svar
=====> Installation
=====> Moduler, plugins, snippets och kod
=====> Design & sidmallar
===> Dokumentation, guider och översättningar
=====> Dokumentation
=====> Guider
=====> Översättningar
===> Webbgemenskap
=====> Meddelanden
=====> Presentera dig själv
=====> Visa upp dina webbsidor
=====> Ordet fritt
=> Slovak
=> Spanish
===> Soporte
=====> FAQ
=====> Instalación
=====> Modulos, Plugins, Snippets & Código
=====> Diseńo y plantillas
===> Documentación, Tutoriales y Traducciones
=====> Documentatción
=====> Tutoriales
=====> Traducciones
===> Comunidad
=====> Anuncios
=====> Presentaciones personales
=====> Muestra de sitios
=====> El Café
=> Swedish
=> TÜRKÇE (Turkish)
===> Destek
=====> SSS
=====> Kurulum
=====> Modüller, Pluginler, Snippetlar & Kodlar
=====> Dizayn & Temalar
===> Belgeleme, Eğitmenler ve Çeviri
=====> Belgeleme
=====> Eğitmenler
=====> Çeviri
===> Topluluk
=====> Duyurular
=====> Kendinizi Tanıtın
=====> Site Vitrini
=====> Konu Dışı