MODx Community Forums
The MODx Blog
Donations
Feedburner Feeds
Documentation
Bugs & Requests
The Wiki
download MODx
plugins, modules, snippets
online demo
Dec 04, 2008, 12:40 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
:Donate to MODx:
Donations
MODx Community Forums
»
Support
»
General Support
(Moderators:
zi
,
PaulGregory
)
»
[Solved] Export TV's content into custom DB table : Ditto + CSV = simple + easy
Pages: [
1
]
Go Down
« Previous topic
Next topic »
Print
Author
Topic: [Solved] Export TV's content into custom DB table : Ditto + CSV = simple + easy (Read 760 times)
0 Members and 1 Guest are viewing this topic.
davidm
Marketing & Design Team
Posts: 6,777
The best way to predict the future is to invent it
[Solved] Export TV's content into custom DB table : Ditto + CSV = simple + easy
«
on:
Mar 28, 2008, 11:23 AM »
I am working on a project which requires me to export the data contained in several TVs into a single table with several fields. This might also become a bounty (if I manage to sell this to the client) to develop a module to automate such an export (not immediate need but I try to look forward...). I'll also probably need to work on importing custom DB tables into TVs but let's talk about this later
This will take some work from me as I am not a MySQL wizard (though I have started toying more and more with MySQL, importing data from other systems and custom tables into modx_site_content with success), and
before I start I'd like either some feedback from people who did it and possibly advice about the process.
I am surprised this has never has been raised (or at last, I didn't find the threads !)
The first thing I plan to do is graphically "map" the fields I need in the custom DB table to the MODx fields which contains the data. Of course, given the way TVs are stored, it will mean mapping fields from several tables (modx_site_content, modx_site_tmplvar_contentvalues for content, and ) with fields from a single table with each field representing a TV.
From modx_site_tmplvar_contentvalues, I need those fields :
tmplvarid -> that's the value I need to tie TVs to the fields I'll create in the custom table
contentid -> that's the value I need to tie modx_site_tmplvar_contentvalues to modx_site_content
value -> that's the content I'll need to move from TVs to the fields I'll create in the custom table
From modx_site_content, I need those fields :
id -> that's the value I need to tie modx_site_content to modx_site_tmplvar_contentvalues
pagetitle -> that's the content I'll need to import into the title field of my custom table
parent -> that's the field I'll need to sort which documents I need to "extract" from the MODx DB
content -> not used in my case, all the data I need is stored in TVs.
«
Last Edit: Mar 28, 2008, 02:34 PM by davidm
»
Logged
.:
nodeo.net
: Pour un web libre, moderne et ouvert ! ::
david-molliere.net
:
Suivez en "live" mes expérimentations et billets sur les CMS et autres applications web
:.
***
Forums modxcms.fr
Participez à l'élaboration du site MODx francophone !
***
! Nouveau !
En live, ne manquez pas les news de modxcms.fr sur Twitter
! Nouveau !
MODx est l'outil idéal pour les developpeurs et webdesigners qui cherchent un framework de gestion de contenu hautement flexible et performant, tout en étant simple d'accès pour les utilisateurs finaux.
Config :
Apache 2.2.8 - MySQL 5.0.45 - PHP 5.2.6 | Debian 4.0 (Etch)
Réalisations sous MODx :
|
pargade-notaires.fr
|
soleil.info
|
gican.asso.fr
|
michelez-notaires.com
|
amadom.gerondicap.com
|
jocelyne-violet.net
Bruno17
Full Member
Posts: 141
Re: Export TV's content into custom DB table : anyone gave a go at this ?
«
Reply #1 on:
Mar 28, 2008, 12:22 PM »
Perhaps you can use something from this one for reading the TVs (xdbfilter):
http://modxcms.com/forums/index.php/topic,23570.0.html
here a little demo :
http://www.meine-goldschmiede.de/index.php?id=34
@INHERIT is not implemented but Im working on it
«
Last Edit: Mar 28, 2008, 12:25 PM by Bruno17
»
Logged
Devs:
[Project] maxigallery with swfupload
Rewritten:
[Module] fast_content_csv v09
[snippet] Xett create, edit, display events + calendars + other DB - things
davidm
Marketing & Design Team
Posts: 6,777
The best way to predict the future is to invent it
Re: Export TV's content into custom DB table : anyone gave a go at this ?
«
Reply #2 on:
Mar 28, 2008, 12:37 PM »
Thanks Bruno but I fail to see how it relates to what I am trying to achieve ?
If you need more information, I need to export TVs into a custom DB table for my client to exploit it outside the context of the web.
Logged
.:
nodeo.net
: Pour un web libre, moderne et ouvert ! ::
david-molliere.net
:
Suivez en "live" mes expérimentations et billets sur les CMS et autres applications web
:.
***
Forums modxcms.fr
Participez à l'élaboration du site MODx francophone !
***
! Nouveau !
En live, ne manquez pas les news de modxcms.fr sur Twitter
! Nouveau !
MODx est l'outil idéal pour les developpeurs et webdesigners qui cherchent un framework de gestion de contenu hautement flexible et performant, tout en étant simple d'accès pour les utilisateurs finaux.
Config :
Apache 2.2.8 - MySQL 5.0.45 - PHP 5.2.6 | Debian 4.0 (Etch)
Réalisations sous MODx :
|
pargade-notaires.fr
|
soleil.info
|
gican.asso.fr
|
michelez-notaires.com
|
amadom.gerondicap.com
|
jocelyne-violet.net
ganeshXL
Testers
Posts: 1,549
Re: Export TV's content into custom DB table : anyone gave a go at this ?
«
Reply #3 on:
Mar 28, 2008, 12:42 PM »
Code:
SELECT
sc.id,
sc.pagetitle,
tv.value
FROM
modx_site_content AS sc,
modx_site_tmplvar_contentvalues AS tv
WHERE sc.parent=55
AND sc.id=tv.contentid
AND tv.tmplvarid=10
GROUP BY sc.id
ORDER BY sc.id ASC
This is an example of exporting one particular TV type (gigLocation = identifier 10), where the document parent is 55, along with the doc id + pagetitle.
It won't automagically insert that data into your custom DB table, and things get a bit more complicated when you want to export several TVs in one go.
Personally, I'd extract the values with PHP, build an multidimensional array, and finally do one INSERT or UPDATE statement for your custom DB table.
I would probably keep the unique ids from the modx-document, to make bughunting etc. easier. Or create one field "original_modx_id" for reference.
You could even use Ditto to spit out a tab-delimited list of all values with your custom tpls, and then use this for import via phpMyAdmin.
Logged
http://www.screengang.com/
·
http://www.online-marketing-consulting.ch/
·
http://www.dnik.ch/
davidm
Marketing & Design Team
Posts: 6,777
The best way to predict the future is to invent it
Re: Export TV's content into custom DB table : anyone gave a go at this ?
«
Reply #4 on:
Mar 28, 2008, 12:46 PM »
Thanks a lot that's exactly what I am looking for !
Great insight and advices
Never occured to me to have Ditto spit out a csv list, awesome idea !
You might just have made this a LOT easier for me, off to experiment !!!
Sure, using PHP would make things way easier and make automating this process possible but I am still short on PHP to achieve that
I might give it a try anyway, might be a way to learn along the way...
«
Last Edit: Mar 28, 2008, 12:52 PM by davidm
»
Logged
.:
nodeo.net
: Pour un web libre, moderne et ouvert ! ::
david-molliere.net
:
Suivez en "live" mes expérimentations et billets sur les CMS et autres applications web
:.
***
Forums modxcms.fr
Participez à l'élaboration du site MODx francophone !
***
! Nouveau !
En live, ne manquez pas les news de modxcms.fr sur Twitter
! Nouveau !
MODx est l'outil idéal pour les developpeurs et webdesigners qui cherchent un framework de gestion de contenu hautement flexible et performant, tout en étant simple d'accès pour les utilisateurs finaux.
Config :
Apache 2.2.8 - MySQL 5.0.45 - PHP 5.2.6 | Debian 4.0 (Etch)
Réalisations sous MODx :
|
pargade-notaires.fr
|
soleil.info
|
gican.asso.fr
|
michelez-notaires.com
|
amadom.gerondicap.com
|
jocelyne-violet.net
Bruno17
Full Member
Posts: 141
Re: Export TV's content into custom DB table : anyone gave a go at this ?
«
Reply #5 on:
Mar 28, 2008, 12:49 PM »
This snippet has functions which read all fields from an document and the tvs in an array. I think you can modify this to write the array in a new or existing db.
Logged
Devs:
[Project] maxigallery with swfupload
Rewritten:
[Module] fast_content_csv v09
[snippet] Xett create, edit, display events + calendars + other DB - things
davidm
Marketing & Design Team
Posts: 6,777
The best way to predict the future is to invent it
Re: Export TV's content into custom DB table : anyone gave a go at this ?
«
Reply #6 on:
Mar 28, 2008, 01:06 PM »
Ok sorry I didn't understand this,
where can I download this snippet ?
Found it :
http://modxcms.com/forums/index.php/topic,23570.msg145591.html#msg145591
I'll look at this right now !
Logged
.:
nodeo.net
: Pour un web libre, moderne et ouvert ! ::
david-molliere.net
:
Suivez en "live" mes expérimentations et billets sur les CMS et autres applications web
:.
***
Forums modxcms.fr
Participez à l'élaboration du site MODx francophone !
***
! Nouveau !
En live, ne manquez pas les news de modxcms.fr sur Twitter
! Nouveau !
MODx est l'outil idéal pour les developpeurs et webdesigners qui cherchent un framework de gestion de contenu hautement flexible et performant, tout en étant simple d'accès pour les utilisateurs finaux.
Config :
Apache 2.2.8 - MySQL 5.0.45 - PHP 5.2.6 | Debian 4.0 (Etch)
Réalisations sous MODx :
|
pargade-notaires.fr
|
soleil.info
|
gican.asso.fr
|
michelez-notaires.com
|
amadom.gerondicap.com
|
jocelyne-violet.net
davidm
Marketing & Design Team
Posts: 6,777
The best way to predict the future is to invent it
Re: Export TV's content into custom DB table : anyone gave a go at this ?
«
Reply #7 on:
Mar 28, 2008, 02:27 PM »
Quote from: ganeshXL on Mar 28, 2008, 12:42 PM
You could even use Ditto to spit out a tab-delimited list of all values with your custom tpls, and then use this for import via phpMyAdmin.
Sometimes the simplest ideas are just the brightest !
I just managed to import my TV's data into the custom DB table
All in 30 minutes... woooot, I love Ditto !
I'll document the process, as it opens many doors to exporting data for clients...
If you come to Paris, I'll buy you diner and a nice wine !
Logged
.:
nodeo.net
: Pour un web libre, moderne et ouvert ! ::
david-molliere.net
:
Suivez en "live" mes expérimentations et billets sur les CMS et autres applications web
:.
***
Forums modxcms.fr
Participez à l'élaboration du site MODx francophone !
***
! Nouveau !
En live, ne manquez pas les news de modxcms.fr sur Twitter
! Nouveau !
MODx est l'outil idéal pour les developpeurs et webdesigners qui cherchent un framework de gestion de contenu hautement flexible et performant, tout en étant simple d'accès pour les utilisateurs finaux.
Config :
Apache 2.2.8 - MySQL 5.0.45 - PHP 5.2.6 | Debian 4.0 (Etch)
Réalisations sous MODx :
|
pargade-notaires.fr
|
soleil.info
|
gican.asso.fr
|
michelez-notaires.com
|
amadom.gerondicap.com
|
jocelyne-violet.net
ganeshXL
Testers
Posts: 1,549
Re: [Solved] Export TV's content into custom DB table : Ditto + CSV = simple + e
«
Reply #8 on:
Mar 28, 2008, 02:38 PM »
Quote
If you come to Paris, I'll buy you diner and a nice wine !
entendu!
Logged
http://www.screengang.com/
·
http://www.online-marketing-consulting.ch/
·
http://www.dnik.ch/
Bruno17
Full Member
Posts: 141
Re: [Solved] Export TV's content into custom DB table : Ditto + CSV = simple + e
«
Reply #9 on:
Mar 29, 2008, 02:24 AM »
Hey, thats realy a cool idea!
And if you want only a part of the rows you can use xdbfilter to select the needed ones.
Logged
Devs:
[Project] maxigallery with swfupload
Rewritten:
[Module] fast_content_csv v09
[snippet] Xett create, edit, display events + calendars + other DB - things
davidm
Marketing & Design Team
Posts: 6,777
The best way to predict the future is to invent it
Re: [Solved] Export TV's content into custom DB table : Ditto + CSV = simple + easy
«
Reply #10 on:
Mar 29, 2008, 07:07 AM »
I really need to take more time to get into xdbfilter, remember I am no dev... but there is big potential for that snippet !
Anyway, yesterday I did a small succesful test but today I exported / imported into my custom DB all the records (125 of them, 20 fields) with no errors
It took some tweaking of the CSV parameters but it works fine : really powerful !
I'll write up a tutorial to post in Tips and Tricks and the Wiki later next week...
Logged
.:
nodeo.net
: Pour un web libre, moderne et ouvert ! ::
david-molliere.net
:
Suivez en "live" mes expérimentations et billets sur les CMS et autres applications web
:.
***
Forums modxcms.fr
Participez à l'élaboration du site MODx francophone !
***
! Nouveau !
En live, ne manquez pas les news de modxcms.fr sur Twitter
! Nouveau !
MODx est l'outil idéal pour les developpeurs et webdesigners qui cherchent un framework de gestion de contenu hautement flexible et performant, tout en étant simple d'accès pour les utilisateurs finaux.
Config :
Apache 2.2.8 - MySQL 5.0.45 - PHP 5.2.6 | Debian 4.0 (Etch)
Réalisations sous MODx :
|
pargade-notaires.fr
|
soleil.info
|
gican.asso.fr
|
michelez-notaires.com
|
amadom.gerondicap.com
|
jocelyne-violet.net
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ışı