Topic: xml structure

How can I create this structure in xml ?



    
        1
    
    
        
        
        
        
        
    
    
        1
        60a19eb042
        otoño
        otoño en mallorca
        galeria content
        3/3/2013´
            This
    =========================    
         
            1
            one
            one text
            one date
         
         
            2
            two
            two text
            two date
         
     ==========================  
    
..::: Moncho Varela ::::..   ..::: @Nakome ::::..   ..::: Github ::::..

nakome's Website

Re: xml structure

http://monstra.org/documentation/xmldb-api

You must create two tables.

1) Table "galleries" with fields: name, title, content, date
2) Table "photos" with filelds: title, content, date, gallery_id

As is normal MySQL Database

But for better perfomance in Monstra: create new "photos" table for each "gallery" table 

1) Table "galleries" with fields: name, title, content, date
2) Table "photos_{gallery_id}" with filelds: title, content, date

Monstra Loves You! Give some love back!

Re: xml structure

1. first question

in install I put this:

Table::create('galeria', array('name','title','content','date'));
Table::create('photos',array('title','content','tags'));

And now in plugin.admin.php

    
$galeria = new Table('galeria');
$photos = new  Table('photos');

as I do this photos_{gallery_id}

2.question
how to do a foreach with 2 tables (array_combine?)

understand me

..::: Moncho Varela ::::..   ..::: @Nakome ::::..   ..::: Github ::::..

nakome's Website

Re: xml structure

Plugin Installation:
Create Table galleries

Table::create('galleries', array('name','title','content','date'));

Create new gallery (and create photos table too)

$galleries = new Table('galleries');
$galleries->insert('Gallery name', 'Gallery title', 'Gallery content', time());
Table::create('galleries_photos_'.$galleries->lastId(), array('name','title','content','date'));

This is just an Idea) Next you must write php logic for working with that tables. Actually it's part of backend development for backend developers )

I think it's deja vu, already discussed this somewhere here...

Monstra Loves You! Give some love back!

5 (edited by nakome 2013-01-17 18:05:12)

Re: xml structure

I have this code:

to delete the photo:

            if (Request::get('del_photo')) {
                if (Security::check(Request::get('token'))) {
                    $id = Request::post('id');
                    $galeria->deleteWhere($id);
                    Request::redirect('index.php?id=sandbox');
                } else { die('csrf detected!'); }
            }

to view photos:

    0) foreach ($records as $row) { ?>
  • <?php echo $row['title']; ?>

    Tags:

    'btn btn-actions', 'onClick'=>'return confirmDelete(\''.__('Are you sure', 'sandbox').'\')')); ?>

Why delete first image  on click  in other image?

..::: Moncho Varela ::::..   ..::: @Nakome ::::..   ..::: Github ::::..

nakome's Website

Re: xml structure

I've solved thanks.

..::: Moncho Varela ::::..   ..::: @Nakome ::::..   ..::: Github ::::..

nakome's Website