Views Attach-Node Content alternate block region output - view

I am using the 'Node Content' output format from the Views Attach module to display nodes referenced to a parent node.
The referenced nodes output as part of the $content variable but I really need it to output in a block separate from the content.

Regular views blocks can't access agruments, but I guess you might try a panels module and a content pane view display. This way you would get some freedom of arranging the results.

Thanks Dmitry Vyal,
I have never used the Panels module and when I tried your suggestion I had problems with Views Panel which made your suggestion unworkable.
However, what I ended up doing was calling my view programatically from page.tpl.php.
Basically, I created the view as a regular block with arguments. We know blocks do not work with arguments but that's if you output it in a region as you would normally do.
My views generated block is only output by printing it from php which is where I also dynamically provide it with arguments.
It works.

Related

Apex main region header with dynamic value

I have tried everything I know to make title of header replicate items value, including substitution string &P10_TITLE_TEXT. inside headers title property. Generally, this would work for normal region, but in my case I try to modify value of pages main region, which is rendering first, before any other item. My assumption is that title text is not showing because it cannot see items value yet.
Is there a simple way to refresh title header after items are ready, or perhaps another better solution?
PS: This is main header of the modal dialog page, that has no property for setting static id, and it's template is less adjustable then normal regions.
Try the following javascript in "Execute When Page Loads" of the modal page:
$('.ui-dialog-title',parent ? parent.document : document).text( apex.items. P10_TITLE_TEXT.value );
Pre-Rendering computations may be the solution here.
You can try creating a computation before Regions under Pre-Rendering to set &P10_TITLE_TEXT.. There will be no need to "refresh". This is if you are simply loading it once.
If you are trying to set headers based on input every time you change it, I would advise separating into two pages so you can submit the page and APEX can reload and process, or just use javascript.

Can somebody give me an eagle eye perspective on Magento blocks, layout and templates?

Can somebody give me an eagle eye perspective on Magento blocks, layout and templates and how they relate to each other?
I understood that blocks are the basic building-blocks that a page is made of and that they are kind of mini-controllers.
I also understood that layout brings these blocks somehow together.
But there is still some uncertainty about templates and how they relate to blocks and layouts and vice versa.
What are blocks?
There are basically 4 things you need to know:
There are two types of blocks: those that automatically render their
children and those that don't. Knowing which type you're using will
help you in debugging.
Magento blocks are essentially models that contain logic for your view templates. Mind you - this is not business logic, but it is logic
related to the display of the information you're presenting. This is
by definition presentational logic. If you're familiar with Zend
Framework's Zend_Layout you could draw a comparison between custom
view objects and layout helpers.
The template file assigned to a block object can execute code as if it is local to that object. That is, $this corresponds directly to
the block class.
Layout actions are a thing that people use.
Two types of blocks
There are two types of blocks at the end of the day - those that
render automatically and those that don't. Take notes because this is
on the Magento Certification exam!!
Auto-rendered blocks
When defined in a layout, any block of type core/text_list will
automatically render all its children. While core/text will
automatically render itself it really only should contain text and
therefore is not useful for layout purposes (though some clever things
can be achieved with them).
Other blocks
Any other block type will need to be rendered manually. Provide the
block an alias which can then be passed to getChildHtml, returning the
content which you then echo.
Layouts And Templates
As the name suggests, layout files are useful in rendering front pages
of Magento. Layout files are XML files that reside in in app > design
frontend > your interface > your theme > layout. Here, you can see that there are many layout files for any given module. Each Magento
module has its own layout files much like the customer module has the
customer.xml layout file, catalog module have catalog.xml layout file
etc. These layout files contain structural blocks and content blocks.
read the following blogs. it will clear your concepts for magneto.
http://alanstorm.com/category/magento
http://devdocs.magento.com/guides/m1x/magefordev/mage-for-dev-4.html
http://blog.philwinkle.com/the-most-misunderstood-concept-in-magento/
http://code.tutsplus.com/tutorials/custom-layouts-and-templates-with-magento--cms-21419
Blocks are the building modules of a page. They can be treated as "bricks". Now every block comes inside a layout. Layout is used to define the "shape" of the page. Now templates are used to define the behaviour of a particular block. That means each block or "brick" will have different charateristic depend upon the template it is used.
That is, to construct a magento page, you need to define a layout first that will give you an idea of shape of that page. Now you fill the layout with blocks. Each blocks now concentrate on a particular section of the entire layout. That means depending upon the "nature" of block, each small section will behave differently. To define the unique nature of a particular section, blocks uses templates (templates actually holds the webpage building codes, ie html + js + php)
I hope that will give you a short idea.
Try to google this. I am sure there are lot of lot of tutorials, blogs available about this.

Laravel blade debug view name on error

when there is some error in view, L4 shows a nice trace, but cached filename:
open: /var/www/webpage/app/storage/views/1154ef6ad153694fd0dbc90f28999013
howto during view-rendering-to-cache save view's path/name (in a comment or something)?
Or better yet - to show it in the debug-error-page (its called whoops or something?)
Thanks ;)
I don't know how to de encrypt view names , but one method i do is to
{{dd('will you reach here ')}}
Trying to move this line from view to another to watch where php render reach .
I know it is not the right way nor the professional one , but it may help in some cases .
This is not exactly a problema, this is a compiled version of your view.
Laravel Blade System will compile all your views and subviews into a single file and, if you didn't change anything on them it will always try to use the compiled version, to speed up your system.
Sometimes is hard to know wich one of our views is related to that error. Using Sublime text, what I do is to hit CTRL-P (windows) and paste the number of the compiled view (1154ef6ad153694fd0dbc90f28999013) and it will bring it to me right away.
Of course, you won't do any changes on it. This is just way to find the view you have problems in, so you can then find the real file and fix it. If you know wich file is the problematic one, you don't have to do this, go directly to your file.
One way to tackle this problem is add a html comments (not blade ones as they will not be rendered in compiled view) in sections which get echoed.
#section('content)
<!-- FILE: app/views/main/index.blade.php -->
<Your Content Goes Here>
#stop
This html comment will get rendered in the compiled source of the view. Of course you will have to inspect the compiled view first to identify which view is the problematic one. But in my experience, this method work almost all the time.
I created a helper that checks to see if you are working locally or in development mode, It then outputs an HTML comment.
{{ printViewComment('mockup/reports#content') }}
<!-- Template: mockup/reports#content -->
I chose to name the comments like this path.file_name#yeild_name but I only wish this was an automated featured.
I found my answer after looking into source,
when on the Whoops! page, just look for render in the sidebar, there will be the name of the view file...

create dynamic template for joomla 1.5

there are tutorials on the web about gow to create index.html, css file and template.xml that contain placeholders. ok, i got it, it's simple. but i need a template that has some different views. for example:
-all pages have a topmenu, header, left sidebar, mainarea and a footer but:
-first page has no header .topmenu after which sidebar, mainarea and footer comes.
-second page has sidebar moved from left to right
-third page has four blocks (blocks for special offers) instead of mainarea.
as far as i can see, i need to create three standalone templates with unique set of placeholders for each template. because i can't see the way to change laarge mainarea placeholder with four placeholders for offers blocks on some pages. dynamically.
is there if-statements in joomla templates to simply determine a document id to view four placeholders instead of mainarea. or to not show header on the main page (f.e. doc. id="mainpage")
but i want it to be selectable like:
-this page has first case of that template (index_1.php)
-and that page has a second case of the same template (index_2.php)
like a selectbox.
is that possible?
I will make this an answer as opposed to a comment since I believe it will do what you are looking for.
Once your articles are setup and your links to them are established (the site has the info on it you're looking for), you can create the modules containing the data that you want shown from time to time.
Go to the module manager - on the right you should see 'module assignment' or something along the lines of 'display this module on the following pages'; you can then pick which pages you want the module to show on. You can specify all pages, none, specific pages, however you want.
This will enable you to show them only where needed however you like.
You can ALSO do this programatically inside the module (if you do custom HTML and use an extension like Sourcerer to add PHP to the module) with PHP should you want a little more flexibility, but just choosing the pages to show on should work for what you're doing.

Yii difference between rendering functions

I sometimes get messed up by the three rendering methods:
Controller::render()
Controller::renderPartial()
Controller::renderFile()
Please could you explain. Thank you!
render() is commonly used to render a view that corresponds to what a user sees as a "page" in your application. It first renders the view you have specified and then renders the layout for the current controller action (if applicable), placing the result of the first render into the layout. It then performs output processing (which at this time means automatically inserting any necessary <script> tags and updating dynamic content) and finally outputs the result.
renderPartial() is commonly used to render a "piece" of a page. The main difference from render() is that this method does not place the results of the render in a layout. By default it also does not perform output processing, but you can override this behavior using the $processOutput parameter.
renderFile() is a low-level method that does the grunt work of rendering: it extracts the data variables in the current scope and then runs the view code. The other two methods internally call this one, but you should practically never need to call it yourself. If you do, keep in mind that you need to pass in a file path (not a view path).
Render File:
Will run the rendering methods on a given file with the set rendering engine. This is fairly low level within Yii and only really used internally or in console commands.
Render Partial:
This takes the alias given and converts it into a file path using all the local variables such as current running controllers and modules and alias definitions. It then pretty much just uses render file.
Render:
This is combination of render partials to make our lives easier. It will render the layout on the currently active contoller, or the defined one, render all the content within it, handle caching of renders, and process the output for client scripts.
Hope that clears it up.
renderPartial() is really useful for displaying ssi components in a page - ie, headers, footers, widgets etc.

Resources