MODx Community Forums
The MODx Blog
Donations
Feedburner Feeds
Documentation
Bugs & Requests
The Wiki
download MODx
plugins, modules, snippets
online demo
Nov 21, 2008, 07:04 AM
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
»
Add-ons, Extensions & Elements
»
Module, Plugin & Snippet Usage
(Moderators:
zi
,
PaulGregory
)
»
[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 5443 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 463 times.)
Logged
Stephan Dale
http://mindspill.net/computing/cross-platform-notes/modx.html
modx(a)mindspill.net
garryn
Coding Team
Posts: 1,175
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,007
looking a little more like my avatar again...
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
Principal @
Collabpad
work
productively.
work
intelligently.
work
together
.
MODx
Development
|
SVN
|
Fisheye
xPDO
Development
|
SVN
|
Fisheye
If you think of yourselves as helpless and ineffectual, it is certain that you will create a despotic government to be your master. The wise despot, therefore, maintains among his subjects a popular sense that they are helpless and ineffectual.
— Frank Herbert
Djamoer
Testers
Posts: 1,492
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,170
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,007
looking a little more like my avatar again...
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
Principal @
Collabpad
work
productively.
work
intelligently.
work
together
.
MODx
Development
|
SVN
|
Fisheye
xPDO
Development
|
SVN
|
Fisheye
If you think of yourselves as helpless and ineffectual, it is certain that you will create a despotic government to be your master. The wise despot, therefore, maintains among his subjects a popular sense that they are helpless and ineffectual.
— Frank Herbert
Djamoer
Testers
Posts: 1,492
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,247
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 484 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
=> Internationalization
===> Bulgarian
===> Chinese
===> Czech
===> Dutch
===> French
===> German
===> Irish
===> Italian
===> Japanese
===> Polish
===> Portuguese
===> Russian
===> Slovak
===> Spanish
===> Swedish
===> Persian - فارسي
-----------------------------
Support
-----------------------------
=> Release Support
===> 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
-----------------------------
Add-ons, Extensions & Elements
-----------------------------
=> Module, Plugin & Snippet Usage
=> General Repository Items Support
=> Navigation & Tagging/Taxonomy
===> Wayfinder & DropMenu
=> Creating & Repurposing Content
===> Ditto
===> Jot
===> QuickEdit
=> 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
-----------------------------
General Discussions
-----------------------------
=> General MODx Discussions
=> Web Design and Development
=> Wishlist
=> You and Your Sites
=> modxcms.com Discussions and Suggestions
=> Off-topic
-----------------------------
Czech Community
-----------------------------
=> Oznámení
===> Důležitá oznámení/novinky
===> Bezpečnost
=> 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)
=> Komunita
===> Oznámení
===> Představte se, prosím
===> Ukázky práce
===> Různé aneb cokoli co se jinam nehodí
-----------------------------
Bulgarian Community
-----------------------------
=> Поддръжка
===> Често задавани въпроси
===> Инсталация
===> Модули, Плъгини, Снипети и код
===> Дизайн и Шаблони
=> Документация, Ръководства и Превод
===> Документация
===> Ръководства
===> Превод
=> Общество
===> Съобщения
===> Представете се
===> Представете сайта си
===> Дискусии извън MODx
-----------------------------
Dutch Community
-----------------------------
=> 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
-----------------------------
Finnish Community
-----------------------------
=> 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
-----------------------------
Filipino Community
-----------------------------
=> 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
-----------------------------
French Community
-----------------------------
=> 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 Community
-----------------------------
=> 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
-----------------------------
Irish Community
-----------------------------
=> Tacaíocht
===> CC Ceisteanna Coitianta
===> Breiseáin (cláir bhreise), Snippets & Comhaid
===> Suiteáil
===> Dearadh & Teimpléid
=> Doiciméid, Teagascóireacht agus Aistriúchán
===> Doiciméadú
===> Teagascóireacht
===> Aistriúchán
=> Pobal
===> Fógraí
===> Cuir Tú Féin in Aithne
===> Gailearaí an Láithreáin
===> Caifé / An Tábhairne / Ábhar Cainte Eile / Ilghnéitheach
-----------------------------
Italian Community
-----------------------------
=> 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 Community
-----------------------------
=> サポート
===> 良くある質問
===> インストール
===> モジュール・プラグイン・スニペット・本体
===> デザインやテンプレート
=> マニュアル・テュートリアル・翻訳
===> マニュアル
===> 事例集、テュートリアル
===> 日本語化
=> コミュニティ
===> お知らせ
===> MODxサイト展示場
===> 自己紹介
===> 雑談
===> 国産リソース
-----------------------------
Persian Community
-----------------------------
=> پشتيباني
===> راهنما
===> نصب
===> ماژول , پلاگین ها , کد ها و جزییات
===> طراحی و قالب ها
=> مستند سازی , آموزش ها و ترجمه ها
===> مستند سازی
===> آموزش ها
===> ترجمه ها
=> انجمن ها
===> اخبار
===> معرفی کردن خود
===> نمایش دادن سایت ها
===> بحث های عمومی و سایر موضوعات
-----------------------------
Polish Community
-----------------------------
=> 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 Community
-----------------------------
=> 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 Community
-----------------------------
=> Поддержка
===> ЧАВО (FAQ)
===> Установка
===> Модули, плагины, сниппеты и код
===> Дизайны и шаблоны
=> Документация, Уроки, Перевод
===> Документация
===> Уроки
===> Перевод
=> Сообщество
===> Объявления
===> Представьтесь публике
===> Галерея сайтов
===> Диван
-----------------------------
Scandinavian Community
-----------------------------
=> 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
-----------------------------
Spanish Community
-----------------------------
=> 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é
-----------------------------
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ışı