Problems, need help? Have a tip or advice? Post it here.
20 posts Page 1 of 2
I have field for uploading image. Sometimes i get this message and sometimes is working?

Tnx for help :)

http://i.imgur.com/PDhyCGv.png
Please move the definition of the field within a cms:template block placed right at the top of your main template (and not in any snippet, for example).

Does this help?
If not please PM me your template and I'll take a look at the code.

Thanks.
KK wrote: Please move the definition of the field within a cms:template block placed right at the top of your main template (and not in any snippet, for example).

Does this help?
If not please PM me your template and I'll take a look at the code.

Thanks.


I have this in snippet folder because it's need to be in there. Is that ok or?
Problem seems to be that the snippet (and hence the editable region's definition contained within it) is executed conditionally - i.e. depending upon whatever logic you've coded, sometimes it executes and sometimes it does not. When it does not, Couch thinks you've removed the definition.

That is why I asked you to place the definition at the very top of the template where we can be sure that the definition gets executed every time the template is run.

It'll make no difference to your code. You can move the definition to within cms:template block and them use <cms:show name_of_region /> where it is currently located. It'll work just the same.
KK wrote: Problem seems to be that the snippet (and hence the editable region's definition contained within it) is executed conditionally - i.e. depending upon whatever logic you've coded, sometimes it executes and sometimes it does not. When it does not, Couch thinks you've removed the definition.

That is why I asked you to place the definition at the very top of the template where we can be sure that the definition gets executed every time the template is run.

It'll make no difference to your code. You can move the definition to within cms:template block and them use <cms:show name_of_region /> where it is currently located. It'll work just the same.


Editable tag is located from the begining at the top of the document

<cms:editable name='prva_slika' type='image' label='Slika' />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">


and i'm showing in the body in some div. and i still get sometimes error. Do you wanna take look?
Do you wanna take look?
Sure. Please PM me the template and the relevant snippets.
Thanks. I had a look and as I suspected you have defined the editable region in a snippet (handling 'list-view').

As I suggested before, the editable region should be moved to the *main* template which, in your case, is 'index.php'.

To make it clearer allow me to spell out the exact steps.

There are two files involved -
a. index.php (this is your main template that shows up in the admin sidebar)
b. index.html (this resides in 'snippet' folder and handles the list-view of the main template above).

The current code you have in 'index.php' is (truncated)
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:template title='Vijest' clonable='1'></cms:template>

<cms:editable name='vijesti_velike' type='richtext' hidden='1' label='Vijesti' />
<cms:if k_is_page>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    ..
    ..
<cms:else/>
    <cms:embed 'index.html'/>
</cms:if>

<?php COUCH::invoke(); ?>

and the current code in the snippet 'index.html' is (truncated)
Code: Select all
<cms:editable name='prva_slika' type='image' label='Slika' />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
..
..

Please remove the editable region definition from index.html to make it -
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>

- and make the code in index.php as follows -
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:template title='Vijest' clonable='1'>
    <cms:editable name='vijesti_velike' type='richtext' hidden='1' label='Vijesti' />
    <cms:editable name='prva_slika' type='image' label='Slika' />
</cms:template>

<cms:if k_is_page>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    ..
    ..
<cms:else/>
    <cms:embed 'index.html'/>
</cms:if>

<?php COUCH::invoke(); ?>

As you can see, I've moved both your editable regions into the cms:template block that is present at the very beginning of the main template i.e. index.php.

Hope this helps.
KK wrote: Thanks. I had a look and as I suspected you have defined the editable region in a snippet (handling 'list-view').

As I suggested before, the editable region should be moved to the *main* template which, in your case, is 'index.php'.

To make it clearer allow me to spell out the exact steps.

There are two files involved -
a. index.php (this is your main template that shows up in the admin sidebar)
b. index.html (this resides in 'snippet' folder and handles the list-view of the main template above).

The current code you have in 'index.php' is (truncated)
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:template title='Vijest' clonable='1'></cms:template>

<cms:editable name='vijesti_velike' type='richtext' hidden='1' label='Vijesti' />
<cms:if k_is_page>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    ..
    ..
<cms:else/>
    <cms:embed 'index.html'/>
</cms:if>

<?php COUCH::invoke(); ?>

and the current code in the snippet 'index.html' is (truncated)
Code: Select all
<cms:editable name='prva_slika' type='image' label='Slika' />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
..
..

Please remove the editable region definition from index.html to make it -
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>

- and make the code in index.php as follows -
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:template title='Vijest' clonable='1'>
    <cms:editable name='vijesti_velike' type='richtext' hidden='1' label='Vijesti' />
    <cms:editable name='prva_slika' type='image' label='Slika' />
</cms:template>

<cms:if k_is_page>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    ..
    ..
<cms:else/>
    <cms:embed 'index.html'/>
</cms:if>

<?php COUCH::invoke(); ?>

As you can see, I've moved both your editable regions into the cms:template block that is present at the very beginning of the main template i.e. index.php.

Hope this helps.


Tnx for help KK. And this will be fine?
And this will be fine?
I think so. Please try and let us know.
KK wrote:
And this will be fine?
I think so. Please try and let us know.


For now is working. But i have some other problem, sometimes i get this:

"You don't have permission to access /couch/ on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request."


i have some code in snippets/index.html because i need to show picture. i'm using index.html for showing 3 news on home of the website...

<cms:show name_of_region />

maybe this is the problem or something else?
20 posts Page 1 of 2