Some beginner questions

Hi all, with my first site I tried to do some quite easy things but I don’t get into it. So I would like to ask 3 basic questions:

  1. If I want to integrate images like a logo, which is the best way?
    At first I put it into neos/Web/img and integrated it into neos/Packages/Sites/Neos.Demo/Resources/Private/Templates/TypoScriptObjects/MainMenu.html directly (). But as I read the documentation and the Code of the demosite this should not be the regular way.

  2. If I want to display 2 different logos, how do I do that?
    On the homepage I’d like to display a different logo as on all other pages. But I can’t get it work.

  3. TypoScript?
    Are there some tutorials that you can adice with which I can get a quick understanding? I find the official documentation not very helpful for a quick overview. Ofcourse there are some examples but the detailed contexts in which they function are not explained. That’s why I find it dificult to understand them an use code in other contexts (because some Objects or Properties are not available and I don’t know why).

Small sorry for that really basic questions but I just can’t find my personel quick door opener. It would be nice if you cann push me into the right direction.

Best regards
Thomas

Hey Thomas,

The best practice to integrate a logo would be to place it into a folder “Images” within the Resources/Public folder in you site package.

Then you can add it via fluid in your template like that:

<img src="{f:uri.resource(path: 'Images/Logo.svg', package: 'YourVendor.YourPackage')}"/>

To answer your question 1:
You could easily extend the example above with using fluid to determine if you are on the root node or on a sub-page and pass the variable to fluid:

Fusion (former TypoScript2):

logo = ${site == documentNode ? 'Home.svg' : 'Subpage.svg'}

Fluid:

<img src="{f:uri.resource(path: 'Images/{logo}', package: 'YourVendor.YourPackage')}">

Or you could also build the complete image tag via fusion and output the tag as a whole in your fluid template.

Question 2:

Have fun :slight_smile:
Cheers, Daniel

Hi Daniel, first of all thanks a lot for your answer. I will have a look at the tutorials you mentioned.

Your suggestion about how to integrate the logo ({f:uri.resource…) works fine however the extended example with the logo variable doesn’t work. To make sure not to have any errors in the project I installed a complete new neos system and demo project. Then I made the suggested changes within the file /neos/Packages/Sites/Neos.Demo/Resources/Private/Templates/FusionObjects/MainMenu.html:
> …
>
> logo = ${q(site).get(0) == documentNode ? ‘logo1.png’ : ‘logo2.png’}
>
>

> …

I suppose that I put your code at the wrong place. But as I don’t understand how the project functions in general I can’t see why and where to put. Maybe you can be so kind to tell me the mistake.

Best regards
Thomas

Hey Thomas,

correct - you placed the so called Fusion Code into the Fluid template :wink:
I guess it really would be best, if you do - or just scan over - the tutorial first to get an idea of what is used to build a site in Neos.

Cheers,
Daniel

Thanks again Daniel.
Nice short basic tutorial. As I can’t make the logo variable available within the main menu file I first need to read some more about docs about how/where Fusion und Fluid work (together). Just too much components that I don’t have any knowledge from.

Greets Thomas

Hi Daniel, I could find a solution now after reading a lot of pages. I pass the name of the page node type into the rendering of the main menu (/neos/Packages/Sites/Neos.Demo/Resources/Private/Templates/TypoScriptObjects/MainMenu.html). Then I decide which logo to take:
> <f:if condition="{nodeType} == ‘Neos.Demo:Homepage’">
> <f:then></f:then>
> <f:else></f:else>
> </f:if>

Don’t know how smart this solution is but it works.

It took me quite some hours to get into it at least a little bit because the official documentation is not that style that I prefer. So I could now solve it but don’t really understand all things in detail. I’m missing a bit a straight top-down documentation (overall view in addition to the detail view) to better understand why this or that functions exactely the way it does. If you have a link to something like that I would be happy if you tell it to me.

Thanks to you for pushing me into the right directions.

Best regards
Thomas

Hi Daniel, it’s me again.
Now I invested the time to read your proposed tutorials and I tried out the examples of the workshop within the official Demo website. I learned many things and I tried out some more details. And there is one point I can’t understand. I did the following steps:

  1. I created a very simple node type definition of super type Neos.Neos:Content.
  2. I created a simple fusion prototype with a templatePath.
  3. I created a simple fluid template with a simple output.

Everything works fine (creating a node in the backend, editing the title and generating the HTML for the node data). But if I just change the super type of the node type to Neos.Neos:Document it seems that the fluid template that is provided explicitely by templatePath is not used any longer. Instead the normal page template seems to be used. Can you tell why this is the case?
The templatePath is provided by

prototype(Neos.Demo:TestDocument) {
templatePath = ‘resource://Neos.Demo/Private/Templates/NodeTypes/TestDoc.html’
}
and it works as expected when the super type is Neos.Neos:Content. I read a lot but just can’t find the clou.

Best regards
Thomas

Page nodes are currently not rendered in the same way as content nodes, so you need to change the root matcher to make that happen. Also a document needs a bit more config to render than a content element. You should inherit from the Neos.Neos:Page prototype.

Hi Christian, tanks!
Is this deviant behavour caused by the system (NEOS) or the project (Demo project)? And where is that decision made exactly? I didn’t read about that in the documentation so far.
And the root matcher is exactly what and where? Something in root.fusion?

Greets Thomas

There is a short explanation video of /root from @dimaip https://www.youtube.com/watch?v=ivpKGoiTxyk

1 Like

Hi Martin, that’s a good one! This will bring me further.
I think I should also have a look at this FusionBP project. Still have another tutorial of Dmitri in my queue where this project is also used. And there seem to be important differences between the current Neos demo project and this FusionBP project.
Thanx Thomas

1 Like

OK guys (@daniellienert @christianm @mficzel ).
Thanks a lot for your help. Have been through many docs/tutorials and of course much more to learn ahaed.

1 Like