Estoy siguiendo un tutorial para crear un modulo en moodle
http://javierav.com/articulos/moodle/2009-09-tutorial-de-creacion-de-un-modulo-para-moodle-1-9-3
Tras modificar el archivo /var/www/moodle/mod/modsms/db/install.xml me aparece el siguiente error al intentar entrar en moodle a traves de "http://localhost/moodle":
Soy nuevo en el mundo del moodle. Y estoy intentando aprender a hacer un modulo facilito para despues hacer uno de proyecto de fin de carrera. Muchas gracias.
Un saludo
En respuesta a Santiago Pascual
Re: Errors found in XMLDB file: Missing TABLES section
de Xavier Paz -
Posiblemente se te olvidó cerrar alguna de las etiquetas XML referente a las tablas, <table> o <tables>
En respuesta a Xavier Paz
Re: Errors found in XMLDB file: Missing TABLES section
de Santiago Pascual -
Muchas gracias por tu respuesta Xavier. Pues el archivo /moodle/mod/modsms/db/install.xml la parte referente a las tablas la tengo así pero me sigue dando el mismo problema. ¿Tengo que modificar algún archivo más?
<?xml version="1.0" encoding="UTF-8" ?>
<xmldb path="mod/modsms/db" version="20090915" comment="XMLDB file for Moodle mod/modsms" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nonamespaceschemalocation="../../../lib/xmldb/xmldb.xsd">
<tables>
<fields>
<field name="id" type="int" length="10" notnull="true" unsigned="true" sequence="true" enum="false">
</field>
<keys>
<key name="primary" type="primary" fields="id">
</key>
</keys>
</fields>
<table name="modsms" comment="tabla principal del modulo modsms, donde se guardan las instancias del mismo">
</table>
</tables>
<statements>
<statement name="insert log_display" type="insert" table="log_display" comment="Initial insert of records on table log_display. Each record describes how data will be showed by log reports.">
<sentences>
<sentence text="(module, action, mtable, field) VALUES ('modsms', 'add', 'modsms', 'name')">
</sentence>
</sentences>
</statement>
</statements>
</xmldb>
Muchas gracias de nuevo.
<?xml version="1.0" encoding="UTF-8" ?>
<xmldb path="mod/modsms/db" version="20090915" comment="XMLDB file for Moodle mod/modsms" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nonamespaceschemalocation="../../../lib/xmldb/xmldb.xsd">
<tables>
<fields>
<field name="id" type="int" length="10" notnull="true" unsigned="true" sequence="true" enum="false">
</field>
<keys>
<key name="primary" type="primary" fields="id">
</key>
</keys>
</fields>
<table name="modsms" comment="tabla principal del modulo modsms, donde se guardan las instancias del mismo">
</table>
</tables>
<statements>
<statement name="insert log_display" type="insert" table="log_display" comment="Initial insert of records on table log_display. Each record describes how data will be showed by log reports.">
<sentences>
<sentence text="(module, action, mtable, field) VALUES ('modsms', 'add', 'modsms', 'name')">
</sentence>
</sentences>
</statement>
</statements>
</xmldb>
Muchas gracias de nuevo.
En respuesta a Santiago Pascual
Re: Errors found in XMLDB file: Missing TABLES section
de Xavier Paz -
Efectivamente, como sospechaba, no lo has creado de forma adecuada. Las etiquetas fields deben estar dentro de las etiquetas table, ya que definen los campos de la tabla. Además, las etiquetas keys van fuera de fields.
La forma adecuada sería:
<tables>
<table name="modsms" comment="tabla principal del modulo modsms, donde se guardan las instancias del mismo">
<fields>
<field name="id" type="int" length="10" notnull="true" unsigned="true" sequence="true" enum="false">
</field>
</fields>
<keys>
<key name="primary" type="primary" fields="id">
</key>
</keys>
</table>
</tables>
Echa un vistazo a este ejemplo del módulo foro:
<TABLE NAME="forum_track_prefs" COMMENT="Tracks each users untracked forums" PREVIOUS="forum_read">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="userid"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="forumid"/>
<FIELD NAME="forumid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="userid"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="userid-forumid" UNIQUE="false" FIELDS="userid, forumid"/>
</INDEXES>
</TABLE>
La forma adecuada sería:
<tables>
<table name="modsms" comment="tabla principal del modulo modsms, donde se guardan las instancias del mismo">
<fields>
<field name="id" type="int" length="10" notnull="true" unsigned="true" sequence="true" enum="false">
</field>
</fields>
<keys>
<key name="primary" type="primary" fields="id">
</key>
</keys>
</table>
</tables>
Echa un vistazo a este ejemplo del módulo foro:
<TABLE NAME="forum_track_prefs" COMMENT="Tracks each users untracked forums" PREVIOUS="forum_read">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="userid"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="forumid"/>
<FIELD NAME="forumid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="userid"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="userid-forumid" UNIQUE="false" FIELDS="userid, forumid"/>
</INDEXES>
</TABLE>
En respuesta a Santiago Pascual
Re: Errors found in XMLDB file: Missing TABLES section
Hola Santiago,
me pregunto si no te resultará más sencillo utilizar el editor XMLDB que viene en cada Moodle.
Es bastante sencillo de usar y genera automáticamente el XML, así como el código PHP en el caso de que quieras realizar modificaciones de la estructura de BD.
Ciao
me pregunto si no te resultará más sencillo utilizar el editor XMLDB que viene en cada Moodle.
Es bastante sencillo de usar y genera automáticamente el XML, así como el código PHP en el caso de que quieras realizar modificaciones de la estructura de BD.
Ciao