MODx Community Forums
The MODx Blog
Donations
Feedburner Feeds
Documentation
Bugs & Requests
The Wiki
download MODx
plugins, modules, snippets
online demo
Jul 05, 2009, 08:43 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
Frequently Asked Questions (FAQ)
MODx Community Forums
»
Add-ons, Extensions & Elements
»
Module, Plugin & Snippet Usage
»
[snippet] ShowSnippet. Show the contents of a snippet as html.
Pages: [
1
]
Go Down
« Previous topic
Next topic »
Print
Author
Topic: [snippet] ShowSnippet. Show the contents of a snippet as html. (Read 6014 times)
0 Members and 1 Guest are viewing this topic.
steph
Member
Posts: 85
[snippet] ShowSnippet. Show the contents of a snippet as html.
«
on:
Jan 28, 2006, 01:00 PM »
Hi all.
I've written a snippet which outputs the contents of another snippet as html. I use it on my site to display the snippets I've written or modified.
http://mindspill.net/computing/cross-platform-notes/modx.html
Steph
ShowSnippetMindspillDotNet.php.zip
(0.88 KB - downloaded 477 times.)
Logged
Stephan Dale
http://mindspill.net/computing/cross-platform-notes/modx.html
modx(a)mindspill.net
garryn
Coding Team
Posts: 1,252
Re: [snippet] ShowSnippet. Show the contents of a snippet as html.
«
Reply #1 on:
Jan 28, 2006, 01:04 PM »
Nice snippet!
That'll save me a bit of time copying and pasting ...
Cheers, Garry
Logged
Search
|
Download Latest Release
|
General Support
About MODx
|
Documentation
|
Bugs/Wishlist
|
FORUM RULES
Garry Nutting
http://www.immerse.me.uk - My Playground
|
My Amazon Wishlist
|
XBOX 360 Gamertag: webnerd
OpenGeek
MODx Co-Founder
Foundation
Posts: 5,814
damn accurate caricatures...
Re: [snippet] ShowSnippet. Show the contents of a snippet as html.
«
Reply #2 on:
Jan 28, 2006, 03:03 PM »
BTW guys, to do this, there is already a built in API function; no extra snippet required!
Code:
$snippetName= 'MySnippet';
$snippetParams= array('param1'=> 'value1, 'param2'=> 'value2',);
$html= $modx->runSnippet($snippetName, $snippetParams);
Not sure why this is not included in the online API documentation, but I'll get that taken care of this weekend.
Let me know if you have any questions on usage.
Logged
Jason Coward
MODx Co-Founder
xPDO Founder
CTO @
Collabpad
work
productively.
work
intelligently.
work
together
.
MODx
Development
|
SVN
|
Fisheye
xPDO
Development
|
SVN
|
Fisheye
Light is just a vibration of a note too. Everything is. You've got to keep that in mind.
Frank Zappa
Djamoer
Emeritus
Posts: 1,495
No one can limit a man other than the man himself.
Re: [snippet] ShowSnippet. Show the contents of a snippet as html.
«
Reply #3 on:
Jan 28, 2006, 11:35 PM »
I thought that this snippet only showing the code in plain text, instead of running them, am I getting this whole discussion right or what?
Sorry, I might not get the whole discussion in here.
Logged
Wendy Novianto (
DJAMOER Solution and Design
)
Search
|
Download Latest Release
|
General Support
About MODx
|
Documentation
|
Bugs/Wishlist
|
FORUM RULES
sottwell
Documentation Team
Posts: 8,837
Re: [snippet] ShowSnippet. Show the contents of a snippet as html.
«
Reply #4 on:
Jan 29, 2006, 02:02 AM »
It doesn't run the snippet, it just outputs the snippet's source code as plain text.
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
OpenGeek
MODx Co-Founder
Foundation
Posts: 5,814
damn accurate caricatures...
Re: [snippet] ShowSnippet. Show the contents of a snippet as html.
«
Reply #5 on:
Jan 29, 2006, 03:27 AM »
Sorry guys, I didn't realize this when I read it the first time. Thanks for the clarification.
Logged
Jason Coward
MODx Co-Founder
xPDO Founder
CTO @
Collabpad
work
productively.
work
intelligently.
work
together
.
MODx
Development
|
SVN
|
Fisheye
xPDO
Development
|
SVN
|
Fisheye
Light is just a vibration of a note too. Everything is. You've got to keep that in mind.
Frank Zappa
Djamoer
Emeritus
Posts: 1,495
No one can limit a man other than the man himself.
Re: [snippet] ShowSnippet. Show the contents of a snippet as html.
«
Reply #6 on:
Jan 29, 2006, 07:55 PM »
Quote from: OpenGeek on Jan 29, 2006, 03:27 AM
Sorry guys, I didn't realize this when I read it the first time. Thanks for the clarification.
lol, Jason, I think you just did way too much programming lately. Time to take a break for a while
Logged
Wendy Novianto (
DJAMOER Solution and Design
)
Search
|
Download Latest Release
|
General Support
About MODx
|
Documentation
|
Bugs/Wishlist
|
FORUM RULES
Mark
Coding Team
Posts: 3,250
Ditto Developer
Re: [snippet] ShowSnippet. Show the contents of a snippet as html.
«
Reply #7 on:
Jan 29, 2006, 07:56 PM »
I believe there is an Etomite snippet that does this with syntax highlighting, etc.
Logged
Documentation
TRAC (Bugtracker)
Forum
How to get help
User Wiki
Credits
SVN Server
Ditto HQ
Stable Download
Development Download
steph
Member
Posts: 85
Re: [snippet] ShowSnippet. Show the contents of a snippet as html.
«
Reply #8 on:
Jan 30, 2006, 03:25 AM »
Hi.
I've found the etomite snippet. It's called DisplayCode and it's on the second page of their miscelaneous snippets...
http://www.etomite.org/browsesnippets.html?int_page=2&lst_category=10
(I didn't link directly to the snippet because I don't think it's allowed).
Ok, that's not allowed either!
I tried it but got a lot of odd characters that couldn't be interpreted by the browser and "Warning: Unexpected character in input" warning messages. Also, some characters, like < and >, aren't encoded into html so the doc is still being interpreted as php (hence the warning messages).
Test page here:
http://mindspill.net/computing/cross-platform-notes/displaycode-snippet-test.html
If anyone gets it working (or if I'm using it in the wrong way) please let me know.
Steph
«
Last Edit: Jan 30, 2006, 03:33 AM by steph
»
Logged
Stephan Dale
http://mindspill.net/computing/cross-platform-notes/modx.html
modx(a)mindspill.net
stempy
Jr. Member
Posts: 48
Re: [snippet] ShowSnippet. Show the contents of a snippet as html.
«
Reply #9 on:
Mar 03, 2006, 05:18 AM »
Updated this slightly to use php's syntax colour highlighting.
Added optional &noHighlight parameter to just display normal html output.
ShowSnippetCode.snippet.txt
(1.74 KB - downloaded 512 times.)
«
Last Edit: Mar 03, 2006, 05:29 AM by stempy
»
Logged
Pages: [
1
]
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ışı