2

I have install structure on existing web site. I have lots of entries. the problem is entries does not working after installing of structure. Because of entries has selected default template group. I need to manually select template group from each entries, but i have lots of entries so, it will take more time.

I have already select templates in channel settings of structure. if i select template group in entries its working properly.

If you have any solution, please let me know.

FYI:

ExpressionEngine: 2.7.2

Structure: 3.3.6

Thanks, Jignesh

2 Answers 2

2

You need to write custom script for this. You can find script example on Structure support forum. My small modification of this script (you need to create template with rights to run php code)

!make DB backup before run the script!

<?php
/**
* Batch reset template_id for Structure entries
*/

$site_pages = ee()->db->query( "SELECT site_pages
                                       FROM exp_sites
                                       WHERE site_id = 1" )->row()->site_pages;

$str = base64_decode($site_pages);
$arr = unserialize ($str);
$new_template_id = PASTE-NEW-TEPLATE-ID-HERE; //e.g. 24;

// Set new template_id
foreach( $arr[1]['templates'] as $key => $template_id )
{
    $arr[1]['templates'][$key] = $new_template_id;
}

// Serialize & encode
$new_arr = serialize($arr);
$new_str = base64_encode($new_arr);


$query =  ee()->db->query( "UPDATE exp_sites
                                   SET site_pages = $new_str
                                   WHERE site_id = 1
                                 " );   
exit;
?>
0

I think yet there is no way but you can do it using sql query directly from db

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.