Problems, need help? Have a tip or advice? Post it here.
6 posts Page 1 of 1
Hi
I think couch is outstanding for me but....
This is my structure/problem:

index.php:
<?php require_once( 'couch/cms.php' ); ?>
bla bla
<cms:editable name='something1' type='richtext'><p>text</p></cms:editable>
<?php include news.php ?>
<?php COUCH::invoke(); ?>

end news.php:
<?php require_once( 'couch/cms.php' ); ?>
bla bla
<cms:editable name='something2' type='richtext'><p>text</p></cms:editable>
<?php COUCH::invoke(); ?>


i want to have index and news editable in couch, but when i execute index.php i got error:
Warning: Cannot modify header information - headers already sent by (output started at W:\www\couch\cms.php:344) in W:\www\couch\cms.php on line 343

Help please.
Hello fakezi and welcome :)

It seems you are trying to 'nest' two independent Couch managed templates (news.php within index.php). No wonder that it is not working.

I think you are looking at the wrong solution. Could you please let me know what exactly are you trying to achieve by trying to nest news within index? I am sure we'll have a better way of getting that done. Do let us know.

Thanks.
Hello KK, and thank you so much that you want to help me. I want to buy a commercial version and in fact I'll do it even if we do not solve this problem, couch is a great option for me, the search for truth in many months.

But I have made ​​a lot of pages on this diagram:
index.php with header (with menu) and footer.
Between the header and footer pages I include: contact, abou us, news .... anything.
And I call them from menu buttons - like this: index.php? id = news.

This file news.php was the only example of the use of such a script:
[header with menu]

if (empty ($ id)) {
if (is_file ("$ id.php")) include "$ id.php";
else echo "<br /> no such page :-(";
}
else include "news.php"; (this is main page)

[footer]

I could finally give up editing index.php but when I tried it and edited only news.php still something is wrong. Couch see index.php in panel...
I apologize for my language.
I'm depends on this program.I could offer CMS to each customer!! :)
I would recommend you read the tutorial to better understand Couch concepts: http://www.couchcms.com/docs/tutorials/portfolio-site/building-a-real-world-site.html
I also have a basic theme available for download, which may be helpful as a code example: http://www.couchcms.com/forum/viewtopic.php?f=2&t=6995

From what I understand, you are using only one template for all your pages, index.php. I recommend you change your approach.

Create a news.php file and visit it while logged in as super admin. Once you have done this, news.php will appear in the admin panel.
@fakezi

The approach you are taking is wide open to the serious threat of 'directory traversal' (https://www.owasp.org/index.php/Path_Traversal). Basically (if you do not add proper checks to the code) your code will allow access to files present anywhere on your server.

This threat apart, the only reason you seem to be using this approach is the ease of adding common header and footer code. With just a little more effort, the same can be done using cms:embed tags e.g. news.php can be modified from existing
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
bla bla
<cms:editable name='something2' type='richtext'><p>text</p></cms:editable>
<?php COUCH::invoke(); ?>

to:
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:embed 'header.html' />
<cms:editable name='something2' type='richtext'><p>text</p></cms:editable>
<cms:embed 'footer.html' />
<?php COUCH::invoke(); ?>

Now news.php can be directly accessed as http://www.site.com/news.php

Using Couch's approach will also make available to you ease of handling individual page views, listings (folder, archive etc.).

I'll agree with @cheesypoof and suggest that you try and use Couch's standard method of porting templates.

Do let us know if you require any kind of assistance in the process.
yes it is true, rather than include news.php should do the opposite: to news.php add header and footer ... just thought it would be easier for me to do this for pages that already exist .... and that is a trick. except that my level is not too high, I'm just lazy. Thank you very much for your help. I really appreciate you taking your time to me.

cheesypoof thx u 2.
6 posts Page 1 of 1
cron