CMS - Editable Content

All WYSIWYG Web Builder support issues that are not covered in the forums below.
Forum rules
IMPORTANT NOTE!!

DO YOU HAVE A QUESTION OR PROBLEM AND WANT QUICK HELP?
THEN PLEASE SHARE A "DEMO" PROJECT.



PLEASE READ THE FORUM RULES BEFORE YOU POST:
http://www.wysiwygwebbuilder.com/forum/viewtopic.php?f=12&t=1901

MUST READ:
http://www.wysiwygwebbuilder.com/getting_started.html
WYSIWYG Web Builder FAQ
Post Reply
brynj
 
 
Posts: 188
Joined: Fri May 31, 2013 3:56 pm

CMS - Editable Content

Post by brynj »

Ok, first dumb question

I am trying to experiment with CMS - Editable Content but having an issue which probably means I have missed something obvious.

I have created 2 pages (both .php) - one with boxes for editable content and one with the content admin panel (these are new pages with nothing else on them)

I added 'summernote editor' and selected that in the admin panel properties.

I published the pages and I can see the content boxes but the admin page just shows a blank page - no admin panel

On the server i can see a folder called 'cms' which is where i published everything for testing (there is a separate folder for summernote)

I do not see "each page will have its own file - For example, index.json, contact.json, about.json etc. The data file will automatically be generated the first time you open the editor." (taken form the instruction) but i guess because that's because there is no way to open the editor.

I tried to set the 'attributes' for the cms folder to 775 (and tried 777) but then i get a '500 Internal Server Error' - if set to 755 I get the blank page without admin panel.
The server is using PHP 5.6 but I have the option to change to 7.3 (just in case this is a factor)
User avatar
Pablo
 
Posts: 21578
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: CMS - Editable Content

Post by Pablo »

Did you install summernote editor?
Was it successfully published to the server?

Note that this is an advanced feature. There is not much I can to do help without knowing your exact settings and configuration.
brynj
 
 
Posts: 188
Joined: Fri May 31, 2013 3:56 pm

Re: CMS - Editable Content

Post by brynj »

HI

Yes i see the summernote folder with the following files/folder
irunin.bmp
irunin.dat
irunin.ini
irunin.lng
summernote-lite.css
summernote-lite.min.js
Plus a folder for 'font'

The summernote folder is in the root directory no within the cms folder - is this correct ?
Last edited by brynj on Wed Sep 02, 2020 11:51 am, edited 1 time in total.
brynj
 
 
Posts: 188
Joined: Fri May 31, 2013 3:56 pm

Re: CMS - Editable Content

Post by brynj »

HI

I appreciate 'Note that this is an advanced feature. There is not much I can to do help without knowing your exact settings and configuration.'

but the only thing i have altered from default is setting summernote as the editor
User avatar
Pablo
 
Posts: 21578
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: CMS - Editable Content

Post by Pablo »

The summernote folder is in the root directory no within the cms folder - is this correct ?
This is correct.
I appreciate 'Note that this is an advanced feature. There is not much I can to do help without knowing your exact settings and configuration.'
The software has thousands of options and millions of possible combinations.
If you need help hen please prepare a demo project so I can see all your settings.
Also include the URL of the page so I can look for errors.
brynj
 
 
Posts: 188
Joined: Fri May 31, 2013 3:56 pm

Re: CMS - Editable Content

Post by brynj »

OK thanks

If the default setting do not work for me on new pages (so nothing to conflict with them) then i will leave it for now and move on to try some of the other new features.
User avatar
Pablo
 
Posts: 21578
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: CMS - Editable Content

Post by Pablo »

Sorry, but I need more information to help you.
Does it work when you do not use SummerNote?
What is the URL?
Are there any errors?
Did you check the PHP error log on the server?
brynj
 
 
Posts: 188
Joined: Fri May 31, 2013 3:56 pm

Re: CMS - Editable Content

Post by brynj »

I have tried without an editor and also CKEditor and still nothing shown except blank page.

There is a server PHP parse error: syntax error, unexpected (referencing editablecontentadmin.php on line 21)

No errors are shown on the webpage,
User avatar
Pablo
 
Posts: 21578
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: CMS - Editable Content

Post by Pablo »

What is the PHP code of editablecontentadmin.php?
brynj
 
 
Posts: 188
Joined: Fri May 31, 2013 3:56 pm

Re: CMS - Editable Content

Post by brynj »

<?php
session_start();
error_reporting(0);
define('ADMIN_PASS', '5f4dcc3b5aa765d61d8327deb882cf99');
$session_timeout = 600;
$username = 'admin';
$labelHome = 'Home';
$labelPage = 'Page';
$labelObject = 'Object';
$labelLabel = 'Label';
$labelContent = 'Content';
$labelAction = 'Action';
$labelCaption = 'Editable Content Administrator';
$labelLogin = 'Login';
$labelLogout = 'Logout';
$labelEdit = 'Edit';
$labelSave = 'Save';
$labelCancel = 'Cancel';
$labelPassword = 'Password';
$objects =
[
['page' => 'page4.php', 'object' => 'EditableContent1', 'label' => 'EditableContent1']
];
$admin_password = isset($_COOKIE['editablecontentadmin_pwd']) ? $_COOKIE['editablecontentadmin_pwd'] : '';

if (empty($admin_password))
{
if (isset($_POST['admin_password']))
{
$admin_password = md5($_POST['admin_password']);
if ($admin_password == ADMIN_PASS)
{
setcookie('editablecontentadmin_pwd', $admin_password, time() + $session_timeout);
}
}
}
else
if ($admin_password == ADMIN_PASS)
{
setcookie('editablecontentadmin_pwd', $admin_password, time() + $session_timeout);
}
$authorized = ($admin_password == ADMIN_PASS);
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
if ($authorized)
{
$content = isset($_POST['content']) ? $_POST['content'] : '';
$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
$database = [];
$database_path = '';
$timestamp = date("y-m-d H:i:s", time());
if ($action == 'edit' || $action == 'update')
{
$database_path = substr($objects[$id]['page'], 0, strrpos($objects[$id]['page'], '.')) . '.json';
if (!file_exists($database_path))
{
$html = '';
$document = new DOMDocument();
if ($document->loadHTMLFile($objects[$id]['page']))
{
$element = $document->getElementById('wb_' . $objects[$id]['object']);
foreach ($element->childNodes as $node)
{
$html .= $document->saveHTML($node);
}
}
$database = [['object' => $objects[$id]['object'], 'content' => $html, 'modified' => $timestamp]];
file_put_contents($database_path, json_encode($database, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
}
$database = json_decode(file_get_contents($database_path), false);
}
if (!empty($action))
{
if ($action == 'update')
{
$found = false;
foreach ($database as $key => $object)
{
if ($object->object == $objects[$id]['object'])
{
$object->content = $content;
$object->modified = $timestamp;
$found = true;
break;
}
}
if (!$found)
{
$database[] = ['object' => $objects[$id]['object'], 'content' => $content, 'modified' => $timestamp];
}
file_put_contents($database_path, json_encode($database, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
header('Location: '.basename(__FILE__));
exit;
}
else
if ($action == 'login')
{
$action = '';
}
else
if ($action == 'logout')
{
session_unset();
session_destroy();
setcookie('editablecontentadmin_pwd', '', time() - 3600);
header('Location: '.basename(__FILE__));
exit;
}
}
}
?>
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Editable Content Administrator</title>
<link rel="stylesheet" href="editablecontentadmin.css" type="text/css">
<script type="text/javascript" src="jquery-1.12.4.min.js"></script>
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="ckeditor/adapters/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$('#editor').ckeditor({});
$('ul.tabs').each(function()
{
var $active, $content, $links = $(this).find('a');
if (window.location.hash == '')
{
$active = $($links[0]);
}
else
{
$active = $($links.filter('[href="'+window.location.hash+'"]')[0] || $links[0]);
}
$active.addClass('active');
$content = $($active.attr('href'));
$links.not($active).each(function ()
{
$($(this).attr('href')).hide();
});
$(this).on('click', 'a', function(e)
{
$active.removeClass('active');
$content.hide();
$active = $(this);
$content = $($(this).attr('href'));
$active.addClass('active');
$content.show();
e.preventDefault();
});
});
});
</script>
</head>
<body>
<?php

if (!$authorized)
{
echo "<table width=\"100%\" border=\"0\">\n";
echo "<tr><td colspan=\"2\" align=\"center\">$labelCaption<br>&nbsp;</td></tr>\n";
echo "<form method=\"post\" action=\"" .basename(__FILE__) . "\">\n";
echo "<tr><td width=\"50%\" align=\"right\"><label for=\"admin_password\">$labelPassword&nbsp;&nbsp;</label></td><td><input class=\"form-control\" type=\"password\" id=\"admin_password\" name=\"admin_password\" size=\"20\"></td></tr>\n";
echo "<tr><td>&nbsp;</td><td align=\"left\"><input class=\"btn\" type=\"submit\" value=\"$labelLogin\" name=\"submit\"></td></tr>\n";
echo "<input type=\"hidden\" name=\"action\" value=\"login\">\n";
echo "</form>\n";
echo "</tr></td></table>\n";
}
else
{
echo "<ul id=\"nav\">\n";
echo " <li><a href=\"" . basename(__FILE__) . "\">$labelHome</a></li>\n";
echo " <li><a href=\"" . basename(__FILE__) . "?action=logout\">$labelLogout</a></li>\n";
echo "</ul>\n";
if (!empty($action))
{
if ($action == 'edit')
{
$content_value = '';
$document = new DOMDocument();
if ($document->loadHTMLFile($objects[$id]['page']))
{
$element = $document->getElementById('wb_' . $objects[$id]['object']);
foreach ($element->childNodes as $node)
{
$content_value .= $document->saveHTML($node);
}
}
foreach ($database as $key => $object)
{
if ($object->object == $objects[$id]['object'])
{
$content_value = $object->content;
break;
}
}
echo "<form action=\"" . basename(__FILE__) . "\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"update\">\n";
echo "<input type=\"hidden\" name=\"id\" value=\"". $id . "\">\n";
echo "<table width=\"100%\" border=\"0\">\n";
echo "<tr><td><label for=\"page\">$labelPage</label></td>\n";
echo "<td><input class=\"form-control\" type=\"text\" style=\"width:100%;\" id=\"page\" name=\"page\" value=\"" . $objects[$id]['page'] . "\" disabled readonly></td></tr>\n";
echo "<tr><td><label for=\"label\">$labelLabel</label></td>\n";
echo "<td><input class=\"form-control\" type=\"text\" style=\"width:100%;\" id=\"label\" name=\"label\" value=\"" . $objects[$id]['label'] . "\" disabled readonly></td></tr>\n";
echo "<tr><td><label for=\"object\">$labelObject</label></td>\n";
echo "<td><input class=\"form-control\" type=\"text\" style=\"width:100%;\" id=\"object\" name=\"object\" value=\"" . $objects[$id]['object'] . "\" disabled readonly></td></tr>\n";
echo "<tr><td><label for=\"editor\">$labelContent</label></td>\n";
echo "<td><textarea id=\"editor\" style=\"width:100%;height:200px\" name=\"content\">" . $content_value . "</textarea></td></tr>\n";
echo "</table>\n";
echo "<input class=\"btn\" style=\"margin-top:6px;\" type=\"submit\" name=\"save\" value=\"$labelSave\">\n";
echo "<a href=\"" . basename(__FILE__) . "\" class=\"btn\" style=\"margin-top:6px;\">$labelCancel</a>\n";
echo "</form>\n";
}
}
else
{
echo "<table class=\"table table-striped table-hover\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">\n";
echo "<thead><tr><th>$labelPage</th><th>$labelObject</th><th>$labelAction</th></tr></thead>\n";
echo "<tbody>\n";
for ($i=0; $i<count($objects); $i++)
{
echo "<tr>\n";
echo "<td>" . $objects[$i]['page'] . "</td>\n";
echo "<td>" . $objects[$i]['label'] . "</td>\n";
echo "<td>\n";
echo " <a href=\"" . basename(__FILE__) . "?action=edit&id=" . $i . "\">$labelEdit</a>\n";
echo "</td>\n";
echo "</tr>\n";
}
echo "</tbody>\n";
echo "</table>\n";
}
}

?>
</body>
</html>
User avatar
Pablo
 
Posts: 21578
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: CMS - Editable Content

Post by Pablo »

I do not see any errors in the code.
Are you sure the PHP version on the server is 5.6 or newer?
brynj
 
 
Posts: 188
Joined: Fri May 31, 2013 3:56 pm

Re: CMS - Editable Content

Post by brynj »

Server says

Native (5.6) (Current)

I have the option of changing that to 7.3 but wary about changing it until/unless I experience numerous problems.

I am a big believer in 'If it isn't broke then don't fix it' :)
Last edited by brynj on Wed Sep 02, 2020 1:16 pm, edited 1 time in total.
User avatar
Pablo
 
Posts: 21578
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: CMS - Editable Content

Post by Pablo »

Did you also try PHP7?
brynj
 
 
Posts: 188
Joined: Fri May 31, 2013 3:56 pm

Re: CMS - Editable Content

Post by brynj »

I am a big believer in 'If it isn't broke then don't fix it'

Do you think 7.3 would make it work ? - would it break anything else I have already done i.e. is it backwardly compatible ?

I don't want to fix 1 issue and create a lot more

I have used WYSIWYG since v6 - should everything that has been working, continue to work ?
User avatar
Pablo
 
Posts: 21578
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: CMS - Editable Content

Post by Pablo »

It should also work with PHP 5.6
But the generated error (by the server) does not make any sense (based on the source code), so that is why I thought maybe PHP7 will give a more useful error message.
I have used WYSIWYG since v6 - should everything that has been working, continue to work ?
All built-in code is compatible with PHP7
WWBman
 
 
Posts: 916
Joined: Fri Jan 08, 2010 6:10 pm

Re: CMS - Editable Content

Post by WWBman »

I have Editable Content working fine with PHP version set to PHP5-PHP7 in Page Properties > Advanced.
You don't have to change this setting in other projects.
brynj
 
 
Posts: 188
Joined: Fri May 31, 2013 3:56 pm

Re: CMS - Editable Content

Post by brynj »

@Pablo

Carefully avoided my other questions - its ok I understand nothing is guaranteed. :)

I am currently using 'Newswriter' without issue and just thought the CMS Editable Content would be an interesting alternative.
Last edited by brynj on Wed Sep 02, 2020 1:33 pm, edited 2 times in total.
brynj
 
 
Posts: 188
Joined: Fri May 31, 2013 3:56 pm

Re: CMS - Editable Content

Post by brynj »

@WWBman

Yes my pages are set the same - I believe Pablo is/was referring to the web hosts server.
WWBman
 
 
Posts: 916
Joined: Fri Jan 08, 2010 6:10 pm

Re: CMS - Editable Content

Post by WWBman »

brynj wrote: Wed Sep 02, 2020 1:32 pm @WWBman

Yes my pages are set the same - I believe Pablo is/was referring to the web hosts server.
OK
brynj
 
 
Posts: 188
Joined: Fri May 31, 2013 3:56 pm

Re: CMS - Editable Content

Post by brynj »

I would be interested if anyone has experience of moving from 5.6 to 7.3 and if everything worked as normal or if they experienced any issues with things no longer working.

I say this as I have no knowledge what to expect if i make the move.
User avatar
Pablo
 
Posts: 21578
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: CMS - Editable Content

Post by Pablo »

All built-in scripts work with PHP7.
brynj
 
 
Posts: 188
Joined: Fri May 31, 2013 3:56 pm

Re: CMS - Editable Content

Post by brynj »

@Pablo

Just thinking - what about the issue of not being able to set permissions to to 775 or 777 as per instructions - is that a possible cause ?

(Reminder - when set to those I get a '500 internal server error' in the browser)
Last edited by brynj on Wed Sep 02, 2020 2:03 pm, edited 2 times in total.
WWBman
 
 
Posts: 916
Joined: Fri Jan 08, 2010 6:10 pm

Re: CMS - Editable Content

Post by WWBman »

FWIW:
All my folders are set to 755
and my files are set to 644.
I never need to change them.
brynj
 
 
Posts: 188
Joined: Fri May 31, 2013 3:56 pm

Re: CMS - Editable Content

Post by brynj »

WWBman wrote: Wed Sep 02, 2020 1:51 pm FWIW:
All my folders are set to 755
and my files are set to 644.
I never need to change them.
Thanks for the info
brynj
 
 
Posts: 188
Joined: Fri May 31, 2013 3:56 pm

Re: CMS - Editable Content

Post by brynj »

Interesting development ......

I signed up to a free webhost and they run PHP v7.4.8 .....

and it works !!!!

So I guess I need to bite the bullet and update to v7 with my normal webhost.
Post Reply