Content not showing

Hi,
I've populated some test pages with some random content using a script.

When I go in the admin I can see the content however when I view (or preview) the content I only get:

    

If I edit the content and commit (by adding and removing a space) then the content appears. I realise it may be the script but just in case it's not and someone has experienced this before i thought I'd ask.



Special thanks to Buggy for his script (sent to me a while back now). It strongly inspired my new one. And the content population is using the same loop. In case it is the script here is the bit:


    // $new_page is a standard page just added with the create_page.php script
    $childAssets = &$GLOBALS['SQ_SYSTEM']->am->getDependantChildren($new_page->id);
            foreach ($childAssets as $childId => $childAssetType)
            {
                if ($childAssetType == "content_type_wysiwyg")
                    { break; }
            }
            $child = &$GLOBALS['SQ_SYSTEM']->am->getAsset($childId, $childAssetType);
            if (!$GLOBALS['SQ_SYSTEM']->am->acquireLock($childId, 'attributes'))
            {
                $GLOBALS['SQ_SYSTEM']->doTransaction('ROLLBACK');
                trigger_error('Failed to acquire attributes lock for #' . $thisId . ' (' . $new_asset_type. ') '.trim($name), E_USER_WARNING);
                return;
            }
    
            $html = $myContent; // string containing random content
            if (!$child->setAttrValue("html", $html))
            {
                $GLOBALS['SQ_SYSTEM']->doTransaction('ROLLBACK');
                trigger_error('Failed to upload HTML for #' . $thisId . ' (' . $new_asset_type. ') '.trim($name), E_USER_WARNING);
                return;
            }
            $child->saveAttributes();
            $GLOBALS['SQ_SYSTEM']->am->releaseLock($childId, 'attributes');


Any help appreciated.
Cheers.

The content file is probably not being generated. That is the cached out file that Matrix serves. Try the following code after you've saved attributes:

    $child_edit_fns =& $child->getEditFns();
    $child_edit_fns->generateContentFile($child);

I actually had this problem occur when creating a number of pages with content through an import script not too long ago.


The saveAttributes call of the Bodycopy Asset has been altered to generate this content file whenever changes are made for this purpose, however this change has only been done in the current development version.



As Greg said the best way to do this in other versions is to generate that content file. This is essentially what committing the page does. It retrieves the html and generates the php code to display it, and creates notice links to any './?a=??' references that the content may contain.

[quote]The saveAttributes call of the Bodycopy Asset has been altered to generate this content file whenever changes are made for this purpose, however this change has only been done in the current development version.[right][post=“7509”]<{POST_SNAPBACK}>[/post][/right][/quote]So, version 3.7 and above won’t need to call generateContentFile?

[quote]So, version 3.7 and above won’t need to call generateContentFile?
[right][post=“8553”]<{POST_SNAPBACK}>[/post][/right][/quote]



Yep that’s right. I have been running imports for a few projects, and after finding and setting the content on the bodycopy’s containers(and calling saveAttributes if required), the page is viewable on the frontend immediately(without committing).