You are not logged in.
Pages: 1
Thanks for the feedback. Did some coding before I went to sleep and ended up doing a mix of #2 and your suggestion.
The basic template includes a self check, if its first path element is en or de. If not, redirect to en and use its current first path element as the new second. This will get a little messy with many templates, but I could move it to a separate PHP file and just include it in any template at the beginning.
Now my routed template with the module kicks in. It gets the page ID from its slug name, verify that the page actually exists and throws 404 if not. It then gets the template used by the page, includes the template PHP file and prepares the resources to be used by the template.
All cases are covered with basic templates, additional routed templates might cause trouble, but could be addressed similar to the first self check as used in basic templates (to prevent website.com/imprint to be accessible)
With the custom checks I could also make it possible to use a translated version of the slug to be used for URL. I'll see how I end up writing the checks for those...
No htaccess used, this stuff just kills me if it gets too complicated ?.
Localization was planned for 5.0 milestone, eh? Curious how that will be solved
Hey there,
I've been trying to figure out how to implement a bilingual version of my website with BigTreeCMS. (I just love it too much to go any other route)
Goal is:
website.com/en/imprint
website.com/de/impressum
alternatively: website.com/en/impressum
ideally, the plage slugs would be localized as well, but linked through canonical tags. if not possible or too much work, I'd just use the German slugs (German company, legal reasons make German the preferred slug language)
Had a few Ideas:
1) use .htaccess to remove /en and /de from link and add it at the end? template then reads it and either plugs in German or English title/content.
2) create a module that has 2 entries, en and de, and forward any slug after it to the actual page (might cause /imprint to be readable as well as /en/imprint with the same page as a result)
3) modify all routing so that the CMS system uses the second path item instead of the first one and create a first one being the variable for language. Preferred solution I guess, but seems to be the hardest for me.
Admin Frontend would be in such a way that a template includes the title and content fields for both languages and the template detects which language is active from the path/url sub-part and parses only the correct language.
Curious on your ideas,
Florian
I've been getting a lot of stuff done with BigTreeCMS lately. it just keeps getting better and better when you know how to work with it.
However, I've came across an interesting 'bug'. Using the 'HTML area' with the 'source code' option I entered a link such as 'javascript:gaOptout()' and saved/published the page. Somehow, the href-content does not get saved into the database and is removed by the system. There's no way to get this link into the page-content except through manual SQL-entry edits.
Is this intentional or considered a bug?
Figured it out.
Changed these in the settings.php:
define("BIGTREE_CUSTOM_BASE_CLASS","MyCustomCMS");
define("BIGTREE_CUSTOM_ADMIN_CLASS",false);
define("BIGTREE_CUSTOM_BASE_CLASS_PATH","../custom/inc/mycustomcms.php");
define("BIGTREE_CUSTOM_ADMIN_CLASS_PATH",false);
and now it works.
BTW, Here's my code snippet for the custom Sitemap. I also added a table to the tree-module-elements so that I can pull their date of last change. it's auto updated by the mysql table itself when anyone writes to it. thus i didn't need to implement the updating function into bigtree.
class MyCustomCMS extends BigTreeCMSBase {
static function drawXMLSitemap() {
header("Content-type: text/xml");
echo '<?xml version="1.0" encoding="UTF-8" ?>';
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">';
$q = sqlquery("SELECT id,template,external,updated_at,seo_invisible,path FROM bigtree_pages WHERE archived = '' AND (publish_at >= NOW() OR publish_at IS NULL) ORDER BY id ASC");while ($f = sqlfetch($q)) {
if (($f["template"] || strpos($f["external"],DOMAIN)) && !($f["seo_invisible"] == "on")) {
if (!$f["template"]) {
$link = static::getInternalPageLink($f["external"]);
} else {
$link = WWW_ROOT.$f["path"].(($f["id"] > 0) ? "/" : ""); // Fix sitemap adding trailing slashes to home
}$lastmod = substr($f["updated_at"], 0, 10);
echo "<url><loc>".$link."</loc><lastmod>".$lastmod."</lastmod></url>\n";
// Added routed template support
$tf = sqlfetch(sqlquery("SELECT bigtree_modules.class AS module_class FROM bigtree_templates JOIN bigtree_modules ON bigtree_modules.id = bigtree_templates.module WHERE bigtree_templates.id = '".$f["template"]."'"));
if ($tf["module_class"]) {
$mod = new $tf["module_class"];
if (method_exists($mod,"getSitemap")) {
$subnav = $mod->getSitemap($f);
foreach ($subnav as $s) {
$lastmod = substr($s["updated_at"], 0, 10);
echo "<url><loc>".$s["link"]."</loc><lastmod>".$lastmod."</lastmod></url>\n";
}
}
$mod = $subnav = null;
}
}
}
echo '</urlset>';
die();
}}
Yep, just copy the drawXMLSitemap method from the BigTreeCMSBase class and do your tweaks in your extension class.
I did so. The file I'm using is in the folder /custom/inc/required/cms.php
When I open the sitemap.xml file via the browser it states
Fatal error: Cannot make static method BigTreeCMSBase::drawXMLSitemap() non static in class MyCustomCMS in /var/www/html/custom/inc/required/cms.php on line 0
if I change the function to "static function drawXMLSitemap()" it works again, but it does not seem to replace the one in BigTreeCMSBase (cms.php from core)
What am I doing wrong? *confused*
Okay. So I would copy the original function into my custom override class file (file name irrelevant?) and try small adjustments at first to find out if it works properly then implement the hidden check and pull the last mod data? Sounds easy, but is probably 5hrs of work for me
I'll try this tomorrow. Today I fiddled around with multiple callout types and proper style integration. Plus the fixes from your last feedbacks. They worked like a charm.
Maybe I didn't make my point quite clear. Useful information, thanks, but I didn't experience any behavior like that before and I'm pretty sure it shouldn't be like that.
Or maybe not?
Anyways, I found out that some of my page_content fields were set to Text Area instead of HTML. So I've changed this now and I shouldn't experience any issues.
The problem I saw that I didn't enter the <p> at all, it appeared there by itself (though from the WYSIWYG editor) and they suddenly appeared in the website again. Should be fixed now though as I was most likely using the wrong field type (and with previous setups I had a wrong/nonworking htmlspecialchars() throughout the site^^)
Tim! Thanks again for such great help. Learning a lot here
This system is so versatile, yet capable. I love it. I hope I'm in a position to say something like that!
Sitemap now includes module-items. Perfect.
Module-items now have their own meta-description. Perfect for proper SEO.
Left to do: implementing the "last modified value" into the sitemap. I'll figure this out by myself. I promise.
it should look like this: (maybe include priority and refresh-tags as well, but last mod should help imho with ranking.)
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<url>
<loc>http://anywebpage.tld/</loc>
<lastmod>2015-06-28</lastmod>
</url>
</urlset>
I'd still like the "SEO-hidden" pages to no show up in the sitemap, so I'll try any figure this if-case out by myself as well. Should have enough information now to actually accomplish such "baby steps". Will post the result of both and what I edited.
Thanks! Stuff like that should go in the docs.
BTW, you rock! Thanks.
I've encountered something that I'd like to fix.
- sitemap does not include the subitems of the modules (i.e. trees -> tree1, tree2, tree3) Did I break this with my modification of the link structure?
- sitemap does include hidden pages though they shouldnt, I assume?
- it's not showing the date the page was last changed
- additional note: I'd like to add a SEO meta description field for each separate module-subpage. its currently getting it from its parent-object, the modulepage itself. any chance to get that done without much trouble?
How do I go about fixing these issues?
/core/inc/bigtree/cms.php
/*
Function: drawXMLSitemap
Outputs an XML sitemap.
*/
static function drawXMLSitemap() {
header("Content-type: text/xml");
echo '<?xml version="1.0" encoding="UTF-8" ?>';
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">';
$q = sqlquery("SELECT id,template,external,path FROM bigtree_pages WHERE archived = '' AND (publish_at >= NOW() OR publish_at IS NULL) ORDER BY id ASC");while ($f = sqlfetch($q)) {
if ($f["template"] || strpos($f["external"],DOMAIN)) {
if (!$f["template"]) {
$link = static::getInternalPageLink($f["external"]);
} else {
$link = WWW_ROOT.$f["path"].(($f["id"] > 0) ? "/" : ""); // Fix sitemap adding trailing slashes to home
}
echo "<url><loc>".$link."</loc></url>\n";
// Added routed template support
$tf = sqlfetch(sqlquery("SELECT bigtree_modules.class AS module_class FROM bigtree_templates JOIN bigtree_modules ON bigtree_modules.id = bigtree_templates.module WHERE bigtree_templates.id = '".$f["template"]."'"));
if ($tf["module_class"]) {
$mod = new $tf["module_class"];
if (method_exists($mod,"getSitemap")) {
$subnav = $mod->getSitemap($f);
foreach ($subnav as $s) {
echo "<url><loc>".$s["link"]."</loc></url>\n";
}
}
$mod = $subnav = null;
}
}
}
echo '</urlset>';
die();
}
Somehow, a different, yet related, issue just came up today. Can't figure out why. Any idea?
What happens: I edit the content of a page and save, it creates the <p> around each paragraph, yet when I call the site, it again displays the TEXT <p> instead of using its html-code-property to display the site as you want it.
I enter:
This is a sample text.
It has two paragraphs.
What is saved in the MySQL table:
<p>This is a sample text.</p><p>It has two paragraphs.</p>
What the Website shows:
<p>This is a sample text.</p><p>It has two paragraphs.</p>
Error causing it, I guess, would be the php-function "htmlspecialchars()" and "htmlentities()". Or is my php just messed up? I'm using php as a module in apache2. Better recommendation?
Here's what I've done. It's probably nothing even close to a well developed system, but i've decided to move the original default.php into a more appropriate name "default_overview.php" and replaced the content in the default.php with the following.
<? if ($bigtree["commands"][0]) {
include "detail.php";
} else {
include "default_overview.php";
}
?>
I could have just placed a lot of echos in the default.php but that looked both confusing and probably would have caused bugs or so. this way should be cleaner as it basically either loads the detail.php OR the default_overview.php.
For better understanding: what exactly does "$bigtree["commands"][0]" do? It checks if the array-element with the name "commands" has 0 elements in it, right? What does "commands" really stand for? Just a passed-through value from the system to know what it should "do"?
One more thing...
I'm very happy so far, everything turned out well. (even my self-coded contact form^^ i need that practice, so that should be ok for now)
I'm using the demo layout and modifying as I go. (best way to learn imho)
There's this thing called a "trees"-module that includes multiple "tree"-entities.
The general page of trees is called by /abc/ and the detail-page of the single tree is called by /abc/detail/xyz/ but I'd like to remove the /detail/ out of it.
First fix I tried was this:
custom/inc/modules/trees.php
from:
function get($item) {
$item = parent::get($item);
$item["detail_link"] = $this->Link."detail/".$item["route"]."/";
return $item;
}function getNav($page) {
$items = $this->getAllPositioned();
$nav = array();
foreach ($items as $item) {
$nav[] = array("title" => $item["title"],"link" => WWW_ROOT.$page["path"]."/detail/".$item["route"]."/");
}
return $nav;
}
to:
function get($item) {
$item = parent::get($item);
$item["detail_link"] = $this->Link."/".$item["route"]."/";
return $item;
}function getNav($page) {
$items = $this->getAllPositioned();
$nav = array();
foreach ($items as $item) {
$nav[] = array("title" => $item["title"],"link" => WWW_ROOT.$page["path"]."/".$item["route"]."/");
}
return $nav;
}
Which would in turn create the correct links when trying to access the detail-pages of the trees, but they cannot be found via that new link. It would only show the "trees" overview page again that is /abc/ ... (/abc/xyz/ goes to the same content as /abc/)
What am I missing?
Database and tables are set to utf8-general-ci.
I copied the same info into header, nav link and content. The mySQL entry is now "schl\u00f6\u00dfer" (page_header) but it's "schlößer" for page content. (which works)
Problem found. Apache2 didn't have "UTF8" set as standard charset. fixed it in /etc/apache2/conf-enabled/charset.conf by uncommenting AddDefaultCharset UTF-8.
Thanks Tim. Works! The only reference to functions is under the "Core" and "BigTreeModule", etc? right? Or is there another document I've been missing?
Sorry for so many questions. I'm not an expert in PHP, but learning with a very steep curve here ?
I've stumbled upon another difficulty I can't seem to figure out myself.
I have implemented a few custom lines of php code in a page-template that is supposed to send an email when called.
When just calling the function sendEmail() it results in an error that this function is unknown.
Doing BigTree::sendEmail() goes a step further but breaks again with no email being sent. How do I know it's using my configured Mailgun-account?
What helped me fix my Error 500 was to make sure that "AllowOverride" was on "All" not "FileInfo".
it looks like the fields that are running through htmlspecialchars are somehow getting encoded incorrectly
Thanks a lot. I appreciate the time you spend helping out.
Something along those lines was my guess too. And the weirdest part is, that it's not happened before (on my first installs, i.e. with debian+lighttpd+normal routing). Since I've wanted to use the advanced routing techniques, I had to switch over to ubuntu 14.04LTS + apache2 and now I encountered that problem.
The database should be in UTF-8 encoding so it should support a very large character set.
Database and tables are set to utf8-general-ci.
I copied the same info into header, nav link and content. The mySQL entry is now "schl\u00f6\u00dfer" (page_header) but it's "schlößer" for page content. (which works)
You can fix this by editing the form and clicking the tools icon next to the Generated Route field. There's a dropdown in the Field Options that is for Source Field -- it should be set to "title". That will fix the route generation to stop making it disappear on save.
Amazing. That easy. Still have to wrap my head around the system, but I just love it.
I do have another weird issue. it doesn't treat Ä Ö Ü and such properly, it breaks it somehow Any reason why?
Hello There.
Big thanks for such a great system so far and I can't wait to see where this is heading. I love it so far, even though I've had a rough time getting to understand the concept behind it. But once you do, it's sweet ?
I've encountered a few glitches and bugs (worst one making it work on a server^^). But honestly. There was one bug that I think is a little annoying as it forces you to use phpmyadmin to fix it after content-change.
I'm using the demo data set of BigTree. When you are modifying the trees, (elements of the class trees), it keeps erasing the route (from "-2" to "") which leads to the item not being able to be called through the website. Fix is easy, Reentering a route in phpmyadmin.
The module-backend page for trees includes all possible information (title, content, galleries, link, attribution, etc.) But it doesn't give the option to change the route while editing the content itself.
Am I missing just something here?
Pages: 1