content file

General questions about CMSimple
Post Reply
stargazer96
Posts: 28
Joined: Sat Jul 07, 2012 6:16 pm
Location: Budapest, Hungary

content file

Post by stargazer96 » Tue Jan 20, 2015 2:02 pm

hi,

would it be possible that content file (content.htm) should be instead one file, two files (content1.htm and content2.htm)?
(content.htm = content1.htm + content2.htm)

$pth['file']['content'] = $pth['folder']['content'] . 'content.htm';

thank you for your help in advance.
Alex

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: content file

Post by cmb » Tue Jan 20, 2015 2:17 pm

stargazer96 wrote:would it be possible that content file (content.htm) should be instead one file, two files (content1.htm and content2.htm)?
(content.htm = content1.htm + content2.htm)
What do you want to accomplish? Why would you want to split content.htm?
Christoph M. Becker – Plugins for CMSimple_XH

stargazer96
Posts: 28
Joined: Sat Jul 07, 2012 6:16 pm
Location: Budapest, Hungary

Re: content file

Post by stargazer96 » Tue Jan 20, 2015 2:45 pm

I would like to have instead one content.htm file, two files,
content1.htm and content2.html, because, -several times I need to use embedded files from my domain to other and at least for me!- content.htm would be mostly hided page urls, if changed url and toc is not founded in content1.htm
to be able to find it in content2.htm
( I hope that I could explaine it, to be undestandible, if not pls excuse me for this, anway my main task is to have
instead content.htm, content1.htm and content2.htm
(content.htm = content1.htm + content2.html).
thank you.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: content file

Post by cmb » Tue Jan 20, 2015 3:06 pm

stargazer96 wrote:I would like to have instead one content.htm file, two files,
content1.htm and content2.html, because, -several times I need to use embedded files from my domain to other and at least for me!- content.htm would be mostly hided page urls, if changed url and toc is not founded in content1.htm
to be able to find it in content2.htm
I'm not sure if I understand you correctly, but it seems to me you want to try content1.htm, and if this file is not good, then you want to use content2.htm. This would be possible with CMSimple, but depending on the version the solution is different. I'll explain for CMSimple_XH 1.6.4.

In cmsimple/functions.php you'll find function rfc() (line 789ff) and at its beginning the following line:

Code: Select all

    $contents = XH_readContents();
You can temporarily change $pth['file']['content'] like so:

Code: Select all

    $oldContentFile = $pth['file']['content'];
    $pth['file']['content'] = $pth['folder']['content'] . 'content1.htm';
    $contents = XH_readContents();
    $pth['file']['content'] = $oldContentFile;
A few lines further down there is:

Code: Select all

    list($u, $tooLong, $h, $l, $c, $pd_router) = array_values($contents);
After this line you would have to check, whether content1.htm is good (whatever that means). If not, you simply load the other content file (content2.htm).

Full code:

Code: Select all

function rfc()
{
    global $c, $cl, $h, $u, $l, $su, $s, $tx, $e, $pth, $pd_router;

    $oldContentFile = $pth['file']['content'];
    $pth['file']['content'] = $pth['folder']['content'] . 'content1.htm';
    $contents = XH_readContents();
    $pth['file']['content'] = $oldContentFile;
    if ($contents === false) {
        e('missing', 'content', $pth['file']['content']);
        $contents = array(
            array(), array(), array(), array(), array(),
            new XH_PageDataRouter(array(), array(), array(), array())
        );
    }
    list($u, $tooLong, $h, $l, $c, $pd_router) = array_values($contents);
    if (!is_good($contents)) {
        $oldContentFile = $pth['file']['content'];
        $pth['file']['content'] = $pth['folder']['content'] . 'content2.htm';
        $contents = XH_readContents();
        $pth['file']['content'] = $oldContentFile;
        if ($contents === false) {
            e('missing', 'content', $pth['file']['content']);
            $contents = array(
                array(), array(), array(), array(), array(),
                new XH_PageDataRouter(array(), array(), array(), array())
            );
        }
        list($u, $tooLong, $h, $l, $c, $pd_router) = array_values($contents);
    }
    
    $duplicate = 0; // this line is already there
    // ...
}
Note, that the function is_good() would have to be defined by yourself.
Christoph M. Becker – Plugins for CMSimple_XH

stargazer96
Posts: 28
Joined: Sat Jul 07, 2012 6:16 pm
Location: Budapest, Hungary

Re: content file

Post by stargazer96 » Tue Jan 20, 2015 3:17 pm

thank you very much for your answer and for your help,
I did not thought that it was so complicated (at least for me, of course :-))
I will read carefully information you sent and I will study it trying to implement it.
If I will have question (and I am sure I will have :-)) I will feed back to you, and I will inform you about the result also.
thank you so much again for your help!

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: content file

Post by cmb » Tue Jan 20, 2015 3:23 pm

stargazer96 wrote:thank you very much for your answer and for your help
You're welcome. And of course, if you have further questions, feel free to ask. :)

BTW: I will delete the duplicate thread in "Open Development".
Christoph M. Becker – Plugins for CMSimple_XH

stargazer96
Posts: 28
Joined: Sat Jul 07, 2012 6:16 pm
Location: Budapest, Hungary

Re: content file

Post by stargazer96 » Tue Jan 20, 2015 7:07 pm

hi Christoph,

thank you again for your help.
I try to implement it, but unfortunatelly, did not succed it.
I use an older 3.3 cmsimple version, littlebit modified/simplyfied, and why I wanted a second content file is because if page / title (h1,h2,h3) is not found on content1.html to search and -if found- display it from the content2.html file.
would it be possible to do it, in very simple way, not so complicated as you previously resolved? :-)
Thank you in advance for your answer.

stargazer96
Posts: 28
Joined: Sat Jul 07, 2012 6:16 pm
Location: Budapest, Hungary

Re: content file

Post by stargazer96 » Wed Jan 21, 2015 7:13 pm

ISSUE RESOLVED !!
Thank you very much Christoph for the solution and for your kind help!

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: content file

Post by cmb » Wed Jan 21, 2015 8:03 pm

stargazer96 wrote:Thank you very much Christoph for the solution and for your kind help!
Your welcome.
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply