Standard page data


(Maroustian) #1

hi…


just wondering…



when you create a new standard page, how are the:



assetid, attrid, linkid, majorid, minorid and treeid



set?



is it like for say, the assetid, incrimented from the highest value or is there a system for incrimentation?



thanks



michael


(Avi Miller) #2

Most of those use database sequences that are sequential numbers, regardless of removed entries. Tree ID is a concatenated string based on the asset's position in the hierarchy.

(Maroustian) #3

thanks avi…
what is the format of the binary string for thr treeid?



00050004

000500040000

0005000400000000

00050004000000000000



would a new standard page underneath the last one look like this?



00050005

000500050000

0005000500000000

00050005000000000000



thanks



michael


(Avi Miller) #4

Its not binary. Each level of the hierarchy gets a base Tree ID, which is then concatenated to its parents. So, the first asset gets 0000, then next gets 0001. However, this is an alpha-numberic string, so you can start seeing IDs like 001A and 002= depending on how many child assets you get. There are functions within the Matrix core to determine the next appropriate Tree ID. This is not a table that should be manualy modified. :)

If you're looking to mass add assets to the system, you should not attempt to do it directly into the database. Rather, we provide a trigger-based engine that allows you to mass create assets based on an XML source file. Take a look at the scripts/import/import_from_xml.php and scripts/export/export_to_xml.php scripts for more info.

(Maroustian) #5

ah cheers avi…
yes i was going to write a script to add standard pages to the system…

ill look at those…



thanks



michael


(Maroustian) #6

i cant find the scripts/export/ folder…
the scripts/import folder is there but no export…

is this export_to_xml.php file around elsewhere?


(Avi Miller) #7

Sorry, they're both in scripts/import – there is also a create_pages.php script in there that can create standard pages from a CSV file. If you are a Squiz Client, you may also have the Import Tools package that can create standard page hierarchies from HTML or Word documents.


(Maroustian) #8

great avi…
ive used the example xml which creates some users…

i want to create pages…

ive exported one of my pages as an xml…

is there an example of an xml to create pages?

i could use a similar format to the generated page xml, but this requires me to manually put in the new assetid's and parent assetid…

i could manually do this [or create a script to allocate new id's] but is there an automate process already around?



thanks…


(Maroustian) #9

i used the csv import [as this seem to create the assetid] and viola, a new standard page "test" is in my system…
although… when i try to add content to the page i.e. table, i get the following errors:



[codebox] PHP Warning

rename(/tmp/string_to_fileLNobkq,[SYSTEM_ROOT]/data/private/assets/bodycopy_div/0008/431/content_file.php) [function.rename]: Permission denied





PHP Warning

rename(/tmp/string_to_fileBS1J9G,[SYSTEM_ROOT]/data/private/assets/bodycopy_div/0008/431/content_file.php) [function.rename]: Permission denied[/codebox]



hmmm… can i fix the permissions?



cheers



michael


(Avi Miller) #10

You probably ran the script as the root user, but Apache can't read/write from the files the script created. In your MySource Matrix system root directory, the following commands will fix the permissions:

    # chown -R apache:apache *
    # find . -type d | xargs chmod 2775
    # find . -type f | xargs chmod 664


That will change everything to be owned by the "apache" user, and fix the permissions too. If your httpd process runs as a different user (for example 'www-data' on Debian-based systems), you'll need to change this to reflect the appropriate username.

I usually use sudo to run commands as Apache, for example:

    # sudo -u apache php install/step_03.php /path/to/matrix

(Maroustian) #11

excellent…
thanks avi…


(Maroustian) #12

hi…
im trying to create table content assets to a standard page…



im using the import_from_xml.php script…



im having some problems…



i get this error when creating rows attributes:



[codebox]

±------------------------------------------------------------------------------------------------------------------------------------------------+

| MySource Warning |

|-------------------------------------------------------------------------------------------------------------------------------------------------|

| The set-attribute trigger action is trying to set a non-scalar attribute to a scalar value; trigger execution aborted [TRIG0003] |

±------------------------------------------------------------------------------------------------------------------------------------------------+

[ – ]

±----------------------------------------------------------+

| MySource Warning |

|-----------------------------------------------------------|

| Action ID "set_bodycopy_table_rows" could not be executed |

±----------------------------------------------------------+

[/codebox]



am i right to use the import_from_xml.php script for this?



here are the details of the xml im using to import:



[codebox]

<actions>



<action>

<action_id>create_bodycopy_table</action_id>

<action_type>create_asset</action_type>

<type_code>bodycopy_table</type_code>

<link_type>2</link_type>

<parentid>446</parentid>

<value></value>

<is_dependant>0</is_dependant>

<is_exclusive>0</is_exclusive>

</action>





<action>

<action_id>create_content_type_wysiwyg</action_id>

<action_type>create_asset</action_type>

<type_code>content_type_wysiwyg</type_code>

<link_type>2</link_type>

<parentid>[[output://create_bodycopy_table.assetid]]</parentid>

<value></value>

<is_dependant>1</is_dependant>

<is_exclusive>1</is_exclusive>

</action>



<action>

<action_id>set_bodycopy_table_rows</action_id>

<action_type>set_attribute_value</action_type>

<asset>[[output://create_bodycopy_table.assetid]]</asset>

<attribute>rows</attribute>

<value><![CDATA[

array (

0 =>

array (

'attributes' =>

array (

),

'cells' =>

array (

0 =>

class bodycopy_table_cell {

var $_tmp =

array (

);

var $attributes =

array (

'linkid' => '',

'content_type' => 'content_type_wysiwyg',

'width' => '',

'height' => '',

'colspan' => '',

'bgcolor' => '',

'align' => '',

'valign' => '',

'nowrap' => '',

);

},

),

),

);

]]>

</value>

</action>



<action>

<action_id>set_bodycopy_table_shadow_links</action_id>

<action_type>set_attribute_value</action_type>

<asset>[[output://create_bodycopy_table.assetid]]</asset>

<attribute>shadow_links</attribute>

<value><![CDATA[

array (

);

]]>

</value>

</action>



<action>

<action_id>set_bodycopy_table_name</action_id>

<action_type>set_attribute_value</action_type>

<asset>[[output://create_bodycopy_table.assetid]]</asset>

<attribute>name</attribute>

<value><![CDATA[

New Table

]]>

</value>

</action>



<action>

<action_id>set_bodycopy_table_attributes</action_id>

<action_type>set_attribute_value</action_type>

<asset>[[output://create_bodycopy_table.assetid]]</asset>

<attribute>attributes</attribute>

<value><![CDATA[

array (

'width' => '',

'bgcolor' => '',

'height' => '',

'background' => '',

'align' => '',

'border' => '',

'cellspacing' => '0',

'cellpadding' => '0',

'disable_keywords' => '',

);

]]>

</value>

</action>



<action>

<action_id>set_content_type_wysiwyg_htmltidy_status</action_id>

<action_type>set_attribute_value</action_type>

<asset>[[output://create_content_type_wysiwyg.assetid]]</asset>

<attribute>htmltidy_status</attribute>

<value><![CDATA[

pass

]]>

</value>

</action>



<action>

<action_id>set_content_type_wysiwyg_name</action_id>

<action_type>set_attribute_value</action_type>

<asset>[[output://create_content_type_wysiwyg.assetid]]</asset>

<attribute>name</attribute>

<value><![CDATA[

Row 1 Cell 1

]]>

</value>

</action>



<action>

<action_id>set_content_type_wysiwyg_html</action_id>

<action_type>set_attribute_value</action_type>

<asset>[[output://create_content_type_wysiwyg.assetid]]</asset>

<attribute>html</attribute>

<value><![CDATA[

<p>blah blah blah</p>

]]>

</value>

</action>



</actions>



[/codebox]



now i think the issue is setting the linkid… i have left it blank as the system should allocate one for it?



if i leave the whole array empty [rows attributes] i dont get any errors but the table isnt linked to the parent and the contents are empty…

also is there any templates for the xml's for creating different types of assets?



thanks



michael


(Maroustian) #13

do i have to add the page and the content all in the same xml?


(Greg Sherwood) #14

If you don't, you'll have to hard-code the page ID into the XML. If that doesn't bother you, then yes.


(Avi Miller) #15

I notice you're creating bodycopy_tables – these containers are deprecated and are not recommended for new MySource Matrix installations. Rather, you should use bodycopy_div containers and use the table editor within the WYSIWYG editor to create tabular data. If you are attempting to migrate from MySource Classic, you really should contact Squiz for assistance. Trying to implement bodycopy_tables usually ends up with a very, very slow system due to the sheer number of assets Matrix has to paint for a single page load.


(Maroustian) #16

thanks avi…
yeah i thought that was the case…

so ive used bodycopy_div instead…

ok… i will contact squiz i just have to get my client details…



michael