Backend no longer rendering after embedding front end

Having trouble installing serendipity?
User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Backend no longer rendering after embedding front end

Post by Timbalu » Wed Jul 08, 2015 4:24 pm

NeilW wrote:Were you trying to access the "content.php" file direct?
Yes. It was the only link I could find on the fly.
NeilW wrote:I am not sure what you mean by that. I am not necessarily saying that I want "some things react on certain Serendipity content". All I am really saying is that I want to produce blog pages that have the header info and social media buttons I need.
So why do you embed the Serendipity "body output" into another framework then?
Why don't you just make your own theme, by copying an exiting one and make that appear as you like it to behave?
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Backend no longer rendering after embedding front end

Post by Timbalu » Wed Jul 08, 2015 4:42 pm

NeilW wrote:These things are just so very important to promoting your blog these days I am really surprised that both you and YL seem to know nothing or very little about it. And they are the things that I want to include on my blog page. This is what everyone is doing right now.
Like I said, I do not know and don't want to know more about social media plugins and usage, than having serendipity_event_findmore and serendipity_event_facebook and ???. :) This is a playground I am totally not interested in! It does not(!) say we do not know about it, even a little more than you think. We have all this and it is working for all people using Serendipity as is. It covers all there is a need to be. This is enough for me. [ AND I NEVER DO WHAT EVERYBODY ELSE DOES! ;-) ]
NeilW wrote:But in essence, I just want a blog that works in a way that most other modern blogs do without having to go to a lot of trouble to learn new code and then spend time putting it all together.
Look, this is exactly the point where I got dizzy. If you want a BLOG System, use it AS IS! Don't cut main things off and wrap all that into another static or dynamic site. Things may start to get complicated then, depending on what you want to have happen. And then for the time being, learn how to extend it by knowledge and the help you get here.
We have static pages, we have a lot of other stunning plugins too and we have the Smarty template engine, which makes using and configurating themes very easy to learn. It still needs some time though. But this is why we have nice themes available, which just are plain ready to use, or very easy to tweak.
Making a copy theme look like the site you actually have or want to have is quite easy.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Backend no longer rendering after embedding front end

Post by Timbalu » Wed Jul 08, 2015 5:47 pm

NeilW wrote:Don Chambers has put together a really nice responsive template using modern tools such as Bootstrap. I am really happy with the visual outcome with my blog.

I would agree that maybe talking with Don about these things could be good. I have seen his name in these forums, but what is the best way to contact him?
Neil, where did you get his theme from? His website. This is the place to contact him, I assume. :) Else he is around here too, from time to time. You could as well send him am PM.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
Don Chambers
Regular
Posts: 3638
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

Re: Backend no longer rendering after embedding front end

Post by Don Chambers » Wed Jul 08, 2015 5:50 pm

NeilW wrote:Don Chambers has put together a really nice responsive template using modern tools such as Bootstrap. I am really happy with the visual outcome with my blog.

I would agree that maybe talking with Don about these things could be good. I have seen his name in these forums, but what is the best way to contact him?
Sorry Neil - I was on vacation for the past week or so, and am slowly coming up to speed on your issues. Seems to me Ian has been doing a pretty good job of responding to you, but if you have any further questions, go ahead and ask.

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Backend no longer rendering after embedding front end

Post by Timbalu » Wed Jul 08, 2015 5:54 pm

Hah - out of the box! :) Good job, Don.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

NeilW
Regular
Posts: 51
Joined: Sat Jun 20, 2015 6:56 am
Contact:

Re: Backend no longer rendering after embedding front end

Post by NeilW » Thu Jul 09, 2015 12:39 am

So why do you embed the Serendipity "body output" into another framework then?
Why don't you just make your own theme, by coping an exiting one and make that appear as you like it to behave?
I think that this is most of the problem. Although I can view all the pieces of a theme in the theme's directory, I have absolutely no idea how they all work and come together and the Docs seem to expect a higher level of understanding than I have.

So while you are simply saying for me to make my own theme, my question is how? I know the basics of copying another theme and making changes - which is how I managed to incorporate Don's theme into my site to the level that I have so far.

I did that by mostly editing the index.tpl starting from the section that is embedded into the site and not worrying about the header section of that file - because my own template looked after that.

I have toyed with the thought of editing the whole index.tpl file and then not embedding it and using it in the standard manner. I believe that this will give me greater access to any plugin that may assist me in manipulating the header code, correct?

But even if that is so, most of the plugins are still very limited by what they do, and to all intents and purposes the index.tpl is still very static in many aspects.

I mean, I don't even know what the index.tpl file is. I just went around the directory opening files and trying to see what each file was. The index.tpl file was the one that appeared most familiar to me, which is why I worked from there, Is the index.tpl file THE static page? If so, what are the "fluid" files? I don't think I wan't static pages.

So have I been editing the wrong file and what files should I be editing to create a custom theme?

Where can I obtain a very simple and layman's explanation or overview of what all the files are in a standard theme (Or preferably Don's Clean Blog theme) and how they relate to each other?

What does each file actually do?

I cannot seem to find any information on this because that knowledge seems to be "expected" of me when I do not have it.

In trying to find out more today, I noticed on Don's own site this page, http://www.optional-necessity.com/archi ... pages.html which also lead to this page http://blog.s9y.org/archives/199-Improv ... lugin.html which says "static page can now have custom properties, similar to blog entries."

I don't mind using a static page if I can get that same level of flexibility - but again, most of the information on those two pages goes over my head because I still do not have the basic level of understanding of how everything works - is there a simple diagram or explanation somewhere?

The other thing that baffles me is if I am able to add custom properties, where are the fields in the blog to do this? To me, if the theme is set-up correctly, a plugin should not be required.

For example, Don's Clean Blog theme has two additional fields on the actual New Entry and Edit Entry pages that allow you to select a custom header image and sub-title for each blog page.

This is great and perhaps the kind of flexibility I am looking for, but I need additional fields at that level to enter a custom page title and other meta tag info.

So how would I start to add fields like that for my own purpose in my custom theme? What file(s) in Don's theme would I need to edit to create more fields and the $variables needed to pick them up in the static page, what other files do I need to edit?

I am still not sure if this will answer all of my issues, but at least it would give me some place to start.

So I guess to fast-track myself on this the main questions out of the above are;

1. Is there a simple diagram or explanation somewhere to give me a basic level of understanding of how everything works?

2. What file(s) in Don's theme would I need to edit to create more fields and the $variables needed to pick them up in the static page and what other files would I need to edit?

Thanks again,

Kind regards,

- Neil

User avatar
Don Chambers
Regular
Posts: 3638
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

Re: Backend no longer rendering after embedding front end

Post by Don Chambers » Thu Jul 09, 2015 2:47 am

Neil - I sincerely appreciate your enthusiasm in adopting s9y for your needs! Ian, Yellowled, me and any number of others are more than willing to help you.

Please allow me to make a suggestion. Many of your posts are very long, and address multiple issues. Allow me to suggest that you keep your posts brief and concise. It is so much easier to walk you through several issues one at a time, than try to address many issues in a single, long post.

As I understand it, you need each blog entry page to output unique html code per page. You are attempting to do this via a few plugins, but are also willing to modify serendipity, or the clean blog theme, to emit these custom page properties. Is this correct?

NeilW
Regular
Posts: 51
Joined: Sat Jun 20, 2015 6:56 am
Contact:

Re: Backend no longer rendering after embedding front end

Post by NeilW » Thu Jul 09, 2015 4:06 am

Hi Don,

Thank you for your reply and sorry for the long posts but they are a probably caused by the fact that while I have the outcome I want very clear in my mind, I do not know the workings of s9y well enough to know exactly how to achieve it.

So at the risk of yet another long post I hope to be able to convey exactly what I need with some code snippets.

If you are familiar with php, I can quickly say that right now for any web page that I build for my site, it will quite possibly have the following structure;

Code: Select all

<!DOCTYPE HTML>
<?php
require ("/home/mysite/header.php");
?>
<?php
require ("/home/mysite/menu.php");
?>
<?php
require ("/home/mysite/body.php");
?>
<?php
require ("/home/mysite/footer.php");
?>
</html>
I find many benefits from using that modular structure and very happy to discuss that at another time.

With the embedded blog, my code could quite possibly look like this;

Code: Select all

<!DOCTYPE HTML>
<?php
require ("/home/mysite/header.php");
?>
<?php
require ("/home/mysite/menu.php");
?>
<?php
echo $blog;
?>
<?php
require ("/home/mysite/footer.php");
?>
</html>
And as you see from the above my require line could be a $variable such as "require $footer;"

Currently, within my "footer.php" I have three other "require" directives.

Now, while "menu.php" and some aspects of the "footer.php" would remain static across all pages things like "header.php", "body.php" and two of the internal files in the "footer.php" are variable - depending on the content of the "body.php". ( Don't worry, I have built a database program that controls all this very effectively :) )

So to answer your question specifically, yes, I need each blog entry page to output unique html code per page.

Or more precisely, unique $variable's of $header, $social, $quotes and $adverts.

So if extra fields for this could be added to your blog entry page, one would hope that entering the applicable path in the field to the section of the required code would render in the blog web page.

That is, in a proposed "Footer" field on the blog entry page I would enter ("/home/mysite/footer.php") which would be wrapped into the $footer variable so that "require $footer;" on the web page would translate to "require ("/home/mysite/footer.php");" and bring the code within that into the main page.

This is totally untested so far as to how it would work in the blog and there are a few other things that would need to be addressed but I hope this clarifies to start us moving positively down the right track.

Thanks kindly,

- Neil

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Backend no longer rendering after embedding front end

Post by Timbalu » Thu Jul 09, 2015 12:04 pm

Let me start to give you a slight overview on our use of Smarty templating, called themes.

They live in /templates and have a name, eg /myTemplate.
This "name" is to find in an info.txt file too, to fetch the right name and theme, when being in the backend theme section, eg "Name: myTheme". So actually a starting "copy theme" changes the directory and the info.txt files value Name, selects the new theme in the backend and thats it.

In your theme you have several *.tpl files, which actually are the Smarty template files and all kind of other files, like theme specific lang php files, stylesheets, javascript files etc. While being processed, the *.tpl files get compiled (translated) to PHP files and are stored in the /templates_c directory, like a "cache". Nothing which is touched by a User, normally.

All themes have or use an index.tpl file, which is the main ground grid markup for your Sites theme. Everything passes through this file! Furthermore a content.tpl file is called, which is a content/body router to some messages and the $ENTRIES and $ARCHIVES Variables, which are the already processed main entries.tpl file and some archives files. Even Staticpages pages pass way through to the entries.tpl file, to reach the hook, even if using a plugin_staticpage*.tpl file itself.
All other *.tpl files are specific files for certain conditions by the Serendipity core, by some plugins, or by the htaccess rewrites. The comments.tpl or the sidebar.tpl files are an example for this.

A theme can also have a config.inc.php file, called automatically, to do certain things to pass to your themes tpl files as assigned variables, or configure the backends theme config. The style.css and the also possible user.css file, as an easy addition to the first, are automatically processed too and set/write the CSS styles for your theme into the "streamed" serendipity.css file, which is called in the head of index.tpl.

Now, this is all about having a BLOG system, with entries floating in and being pushed into the backyard by new ones. By time it was necessary to have some static pages, which could hold the imprint of the site or any other static SITE content, not being the same as "floating" blogentries. This is why the static pages event plugin was coded long ago. So if you want some static pages, with content you want to have for your SITE like a CMS has, this is Staticpages. You can now build a navigation area like the 2k11 theme has, and link your staticpages into this nav or have them displayed in the sidebar. With the mentioned additions by Garvin in 2008, this vastly improved the abilities of Serendipity as a CMS, but still went on being focussed to be and stay a BLOG software.

How to use and learn Smarty is documented here: http://www.smarty.net/docs/en/

What you need is a good copy template, which gives you as much possibilities you may ever need (eg, 2k11 or Next) or a certain one, which comes near your Sites approach.

The headers and footers and the depending hooks for the Serendipity Plugins are all to find in the index.tpl file, but may as well be just a result of some core processing to get into there.

You may put the html markup and Smarty conditions directly into the index.tpl, or use it by {include ...} or other inheritances, etc, depending on your Knowledge and/or Preferences. I would recommend to start with a plain copy and very small changes to get an idea of what happens when. Even if possible when having some Knowledge, it is not really recommended to use any PHP in the Smarty templates. This is what the config.inc.php file could be used for, which is not for the Beginners, though.

Good luck!
I think for the rest Don will be an excellent Guide, particularly if you use his theme!

(@All - If I forgot something essential to mention, please add!)
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
Don Chambers
Regular
Posts: 3638
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

Re: Backend no longer rendering after embedding front end

Post by Don Chambers » Thu Jul 09, 2015 3:30 pm

Before I reply further, is this topic essentially the same being discussed here?

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Backend no longer rendering after embedding front end

Post by Timbalu » Thu Jul 09, 2015 3:39 pm

Yes!
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
Don Chambers
Regular
Posts: 3638
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

Re: Backend no longer rendering after embedding front end

Post by Don Chambers » Thu Jul 09, 2015 4:27 pm

I have worked on maybe a half dozen embedded s9y installs. Eventually, I decided it was typically easier to code a theme to match the root site. The last time I did that was here.

Now having said that, let me try to see if we can help Neil. As Ian explained, all themes use the smarty file index.tpl. One of the very first lines in that file is this:

Code: Select all

{if $is_embedded != true}
Which means "if not embedded".... which in turn means everything in index.tpl's <head> is bypassed when s9y is embedded... so, no stylesheets, no fonts, and in the case of the theme Clean Blog, no header background images.

The "if not embedded" has an else statement - that being:

Code: Select all

{serendipity_hookPlugin hook="frontend_header"}
This smarty code also exists within the <head> of this theme, and most/all other themes.

Help me out here Ian - the frontend_header hook is where plugins that emit content intended for <head> is emitted, correct? If so, the output from a plugin such as serendipity_event_metadesc should still work in an embedded blog, correct?

Neil - can you install that plugin, then create a sample entry with custom meta descriptions and keywords so we can see if it works? I don't have access to an embedded install and don't really have time to set one up.

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Backend no longer rendering after embedding front end

Post by Timbalu » Thu Jul 09, 2015 4:41 pm

Don Chambers wrote:Help me out here Ian - the frontend_header hook is where plugins that emit content intended for <head> is emitted, correct? If so, the output from a plugin such as serendipity_event_metadesc should still work in an embedded blog, correct?
1. Yes 2. No, since the serendipity_event_metadesc plugin uses the 'frontend_header' hook for this.

Edit: Sorry, did not look into a long time... ;-)

Code: Select all

{if $is_embedded != true}
<!doctype html>
..... [too much to show here] .....
{serendipity_hookPlugin hook="frontend_header"}
    <script src="{$head_link_script}"></script>
</head>
<body{if $template_option.webfonts != 'none'} class="{$template_option.webfonts}"{/if}>
{else}
{serendipity_hookPlugin hook="frontend_header"}
{/if}
So actually the {else} part belongs to {if $is_embedded != true} so we have both and the answer to 2. is YES too! :)

PS. If that is a good idea to have meta links in the body part is another question though!
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

NeilW
Regular
Posts: 51
Joined: Sat Jun 20, 2015 6:56 am
Contact:

Re: Backend no longer rendering after embedding front end

Post by NeilW » Fri Jul 10, 2015 9:27 am

Hi Don, onli, Ian and YL,
Don Chambers wrote:Before I reply further, is this topic essentially the same being discussed here?
Yes sorry, it is not my habit to start off multiple threads. My problem initially started here as an installation problem and, on advice, I started up the other thread. This one never wanted to 'die' though so hence the two. :oops:
Don Chambers wrote:Neil - can you install that plugin, then create a sample entry with custom meta descriptions and keywords so we can see if it works? I don't have access to an embedded install and don't really have time to set one up.
Don I did previously install the serendipity_event_metadesc to see if that would work for me, and there is perhaps hope for it yet, but like most of the plugins here the instructions are extremely scant.

When I tried entering the page title which I thought would edit the <title> in the html header, it actually changed the title of my blog on the blog page.

I also can't understand why it says to "Enter a comma-separated list of HTML tags that should be searched, which usually contain keywords" when the field is designated to hold just keywords. HTML tags are items that are placed in "<>" code to me. :?

But I would like to thank everyone for their very kind assistance to date and it is really very much appreciated, but I wonder if I could ask for a "time-out" over the weekend, please?

The reason that I ask is that I have looked closer at the serendipity_event_entryproperties plugin that is needed for Don's theme.

I did not look that closely at it at first, but now notice that it allows me to create custom fields myself at entry level - which is one of the things I have been asking about here.

This is a huge break-through for me.

The really nice thing about it is that anything that you enter into those fields goes straight into the embedded blog code - without being wrapped inside any other tags.

This means that your can enter native html code into the field and it will render within the blog.

I also entered the code for the social media buttons that I use (which contains java script) and that seems to work as well.

The only thing that does not work is php code. :(

I can enter it but it does not render - even though you can see it on the page when you look at the source code in the browser. So it is definitely there, but is greyed like a comment so just not activating, even though my pages are all php pages.

But instead of calling the code in with php, I can just copy and paste the custom code into the field and it will render - so no big deal really. (Not sure if there is a JavaScript equivalent to the php "require" that may come in handy and activate in the same way as the social buttons render - but I will also look into that.)

Other than that, the only thing I have to do is to try to edit the content.php and the entries.tpl pages to see if I can get everything rendering in the right place plus have a look at Don's css to try to widen up sections of the blog in line with all the other pages on my site.

So the war is not over yet, but it looks like I am beginning to win some battles which makes me feel so much better than I have over the past week.

But if you could give me the weekend to look at all of this it will allow you to have your weekend with getting involved in my problems ;) and also allow me to cut away some of the trees to better see the forrest.

I will keep you in touch with my progress as all this learning may help others here.

Thanks again and have a great weekend,

- Neil

User avatar
Don Chambers
Regular
Posts: 3638
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

Re: Backend no longer rendering after embedding front end

Post by Don Chambers » Fri Jul 10, 2015 4:14 pm

ok - have a good weekend and let us know what you still need help with next week.

Post Reply