Overview page of elements from a Typo3 page tree - database

I'm primarily a UI and graphic designer and, eventhough I have some experience with Typo3, I'm completely stuck at the following problem:
I have a large page tree with single pages for items from a catalogue (one item per page), the layouts for these items are built with Armin Vieweg's beautiful "Dynamic Content Elements" extension (DCE).
Now I want to create an overview page where I reference some of those items automatically - ideally I want to check a box in each element I want to display there (I would add a field catalogueItemPreview to the item DCE which authors can check or uncheck).
Unfortunately, I have no concrete idea of how the database is structured and how I could build a query (where would I even do that? in a custom-made plugin?).
This is how I imagine it could work: On the overview page I use a plugin/an extension in a Content Element that does the following:
search Typo3 DB for content elements with a field called "catalogueItemPreview"
return fields "catalogueItemTitle", "catalogueItemShortDescription", "cataloguePreviewImage"
use a template to render previews of all those elements on the overview page
I'm happy for ANY pointers towards a solution as currently I'm completely in the dark about where even to begin ...
Schematic screenshot from the Typo3 backend

thanks for using my DCE extension :)
Well the fields you have defined and their values in content elements are stored as XML, because the current version of DCE is based on Flexforms.
This makes it very very difficult to do MySQL queries using one of the field properties in WHERE clause. You could check for a xml string in the field pi_flexform but this is not recommended.
Instead I would use another property of content elements (tt_content) to mark the items as "Show on frontpage". For example you could create a new layout or section_frame value for that. Then it is very easy to just output the elements you want, using TypoScript.

Related

C1 as a store and editor for custom private files

Preface
Our site uses C1 as a CMS for public area (info, help, faq, etc.).
Our private area is implemented as a standalone ASP.NET app, so there almost no connection between the CMS and the app.
In the app there are ~50 email templates (HTML+razor), and almost all of them are localized (8 languages).
At the moment those templates are stored as files, and they are under the source control. Consequently, any editing is done by developers.
The goal
We'd like to put those template files under the control of Composite C1 and thereby make them editable by people who manage the content.
The key requirements:
The template files must not be accessible by the internet user; the CMS must only show them in the administration console and allow to edit them. It's easy to achieve this by putting the files in e.g. App_Data, so they will be observable in the System perspective, however it's not the best way when considering security, and it doesn't help with the following requirements.
It would be great to have the published/unpublished feature applied to these files, just like the pages in the Content perspective.
It would be great to use the built-in C1 localization feature, so that at a time only those files are visible, which are in the currently selected language.
The questions
Is there anybody who had experience with putting such private content under the C1 control?
In order to meet the requirements, would it make us to store our email templates in the CMS database instead of storing them as files?
UPDATE
In the Data perspective it's possible to create a custom global datatype suitable for storing email templates: it's just necessary to have at least one field "Body" of type String with the xhtml editor assigned to it. This way it's possible to add all the templates into the database, and there are abilities to make them published/unpublished and localized. The application would have to access the templates via the database, what is OK.
The only actual problem is that the xhtml editor should be reconfigured to allow non-strict html with razor. Any advice on that?
So, here is the solution we've ended with.
Create custom global datatype EmailTemplate in the Data perspective.
Tick the "Has publishing" checkbox in the Settings tab.
The most important fields are:
TemplateID - the string identifier of the email template
Body - the template text
The Body field should be thoroughly configured:
Field type: String
String maximum length: Unlimited length
Advanced config: Widget type: VisualXhtmlEditor
Enable Localization for the newly created datatype (see its context menu).
Edit Form Markup for the newly created datatype (see its context menu).
Replace the InlineXhtmlEditor element with the following code:
<TextEditor Label="Template" Help="" MimeType="application/x-cshtml">
<cms:bind source="Body" />
</TextEditor>
This way the editor is configured to support the html+razor syntax.
Show the datatype in Content perspective (see its context menu).
This way the email templates appear in the Website Items of the Content tree.
How the application can access the published email templates
In the CMS database the following tables will be created:
dbo.<datatype_name_with_namespace>_<culture_code>
dbo.<datatype_name_with_namespace>_Unpublished_<culture_code>
For example
dbo.Composite_EmailTemplate_en_GB
dbo.Composite_EmailTemplate_Unpublished_en_GB
dbo.Composite_EmailTemplate_de_DE
dbo.Composite_EmailTemplate_Unpublished_de_DE
...
Each table has columns that correspond the fields configured for the datatype, e.g. TemplateID and Body.
I believe now it's clear how to find certain template in certain culture.

How to generate tile of artical automatically in drupal?

There are several fields and I want generate title from these fields by concatenating them by character '||' in an article in Drupal. However I find it that you must input article title manually, then how to generate title automatically?
I have used Auto Node Title in a project for my client and worked fine to generate titles automatically for the nodes. I don't know if with it you can generate title for the other fields also, but maybe with some additional configuration it would be possible to do

Drupal 7: Adding content/nodes from custom content type pages to another page

I'm working on a Drupal site an need to implement the following:
I have created an about us page template (page--about.tpl.php) and a custom content type for the about us page and linked the 2 using suggestions. I also have a custom content type for staff profiles that I need to add on the about us page in a tabbed format.
I can't seem to find a way to get the staff content to display in the about us page. I would ideally like it to render it the same manner as blog posts would display in a blog page.
So my question is, what code do I use to render all the nodes of the staff profiles content type in the about template page?
p.s I'm a bit of a Drupal noob, done a lot of reading but come up empty on this one.
If you already created content type About us (that is what i understood from mockup and explanation) then maybe you could use Views with EVA. That will enable you to have view as field in content type.
You can set it up with manage display or print it in template as all other fields. For example:
<?php print render($content['your_view_entity_view_1']); ?>
Other way would be to embed view in template. For example:
<?php print views_embed_view('your_view', 'block'); ?>
You can use the excellent Views module to create a block to list all your staffs.
Then you need to place the block that you had created with the help of view module in about-us page.
The Views module will give you suggestions to about which template to use.
EDIT: After the op provided the following image.
After you create a view to show all the Team member nodes you could simply print the view in your about us specific page template using following code.
$view = views_get_view('view name');
print $view->render('display_id');
Another option to do the same thing is, make blocks for all the content, viz. The Firm, The Team, Awards, Technonogly, Services and use quicktabs to display the content.
Yet another option to show a view as a field for a node is use EVA
Going the quicktabs way you can provide a lot of flexibility of showing teaser in about us page and leading to details about the same. For example each award can be a node in itself.

Render a page differently based on which list that opened it

I have two lists of different PageTypes - NewsItems and PressReleases. They are displayed in one list each, with links to the individual items.
Now I want to include the press release items into the news list and use the style of the news items to display them as news items. They share properties like "Heading" and "BodyText", which are used in the News Template.
I imagine that it won't be that difficult to feed the NewsItems' ListPage with both sets of pages, but I don't understand how I can control the rendering of the item page.
I would like to take the PageData object from a NewsItem OR a PressReleaseItem and display it using the News-Item.aspx template, if it is selected in a NewsList. But EPiServer will always render the PressReleaseItem with the PR-Item.aspx since it's coupled in the PageType settings.
Anyone know how to accomplish this?
EDIT: An effort to clarify:
The important issue is how to know the "list parent" and choose the right template from that. In the ListPage I can apply different looks on the PR and News items respectively using tompipes answer, but when selecting to see an individual item EPi will render the PR-Item-1 the same way regardless of their "list parent". That's the problem.
I'm not following exactly what you are attempting here. But I think I get the gist of it.
Why not use one aspx template for both page types, but in the code behind switch off sections using the visible attribute.
If you are using PageTypeBuilder you could use the "is" keyword:
somePlaceHolder.Visible = CurrentPage is NewsItemList;
If you're not using PTB, you could use something like:
somePlaceholder.Visble = CurrentPage.PageTypeID == 10;
or
somePlaceholder.Visble = CurrentPage.PageTypeName == "NewsItemList";
I'll point out now I'm not a fan of hardcoding anything, so I would place the template name, or ID into a config file, or a property on the start/root page to avoid hardcoding them.
Let me know if this will help, or if I have misunderstood please try elaborate on your issue.
Depending on how much the templates share you could go with user controls, placeholders or even different masterpages to switch view in a suitable way.
To know when to switch you could use a querystring parameter, session variable or the nicest looking way would probably be to lookup and get the list's PageData object by the HTTP referrer. If it's empty you will get press release rendering as the worst case.
I tried lots of solutions, including the adding of querystring to the PR items in the list links, the getting of referring url in the item template and different types of event hooking for automatic publishing of news items from a PR item (although I only looked at the code samples for that one), and finally came to the conclusion that they all had something that told me not to go that way. (Making the code too complex, or the markup logic too hard to understand and so forth)
I ended up using Fetch data from another EPiServer page, and creating a "shortcut pagetype" in which I let my editors pick which PR item should be used as base for a news item.
This shortcut pagetype is called "PR-as-news-itemPage" and it is rendered with the same aspx as ordinary news items: News-Item.aspx. Having no properties of its own, it will take all relevant data from the PR item selected with "Fetch..."
To render PR items with all its properties I created an ordinary new pagetype called PR-Item.aspx. This renders the "Attribute 2" property, which is only rendered by PR-item.aspx, and not by News-Item.aspx.
(I could have gone even simpler, by letting the editors use the old News-Item page type and use the "Fetch..." property there, but I have some mandatory properties in that page type which I didn't want to make optional for this sake.)

Salesforce.com visualforce between 2 objects

In salesforce I need to create a visualforce page that includes the fields of 2 objects. The first object is the QUOTE object. The second objects is a custom object with several fields.
I want to create a visualforce page that shows the records of both QUOTE and the new object. Can I do this without creating a custom controller? If no any hints on the code for this new controller?
Can I do calculations between fields in a visualforce page?
Ideally I want this page to appear as soon as the QUOTE is set to ACCEPTED
1: You can't do this without a custom controller unfortunately, unless one object is related to the other and you're just happy displaying it as a related list on the parent object's page. For calculations you could use rollup summaries for some basic sums etc..
As for a custom controller, have a look at field sets for a super easy way to get fields into a VF page, you essentially configure groups of fields on your objects and then you can stick those groups onto a page with minimal markup.
2: For fields with complex calculations you'll want to do the sums in the controller and then expose the results through variables onto the page in the usual manner.
3: Not really possible without creating a custom edit page in the first place — you'd be better off having a button on the quote page to open up the Visualforce page, that page can simply display an error if the quote is not yet accepted. There are some other alternatives that might work though, like using a forumla field to generate a link to the page when the status is as you desire.
I'm happy to elaborate on any of this, but the fact that you're asking about number 2 would suggest to me that you don't have much experience developing on the platform (not a dig, just an observation), so unless you're comfortable coding in other environments you could find this quite tricky. That said, you're on stackoverflow so I'm thinking you probably know a little about coding at least!

Resources