I have a view block of content type "Career". I want to show a custom block when the "Career" is empty.
I tried to add in "NO RESULTS BEHAVIOR" a field (Global: Rendered entity - Custom block (Global: Rendered entity - Custom block) and I typed the id of the custom block.
- The content of custom block is shown in the view block, but I don't know why when I reload the page, I got nothing in place of view block.
What should I do?
Related
I created a view with a page display and a block display.
(1) The page view displays several content "A" with a pager (one full content by "page of pager"). ( in drupalsite/myview )
(2) The block shows the liste of content "A". (put in drupalsite/myview )
This is very simply.
Now I have my page (drupalsite/myview) with : the block view (1) and the view pager (2). When I click on a number X of the pager widget, the view display the content number X (drupalsite/myview?page=X) but when I click on one content in the block view the page load (goto drupalsite/node/X) and display only the content (there is no longer the view with the pager)
How can I do that ?
If I click on the item in the block view, the user isn't redirected to the node page. Instead, the view pager refresh, I mean :
In the block view, I click on a item, I go to drupal/myview?page=X (not drupalsite/node/X). The view module can manage that or I must create a custom module ?
Yes it is possible.
1) Install View Path http://drupal.org/project/views_php
2) Add a Global PHP field
3) In the output Code box put
<?php
$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
echo $actual_link;
?>
4) In the 'Rewrite Results' check 'Rewrite the output of this field' and put [title] in the Text box
5) check also 'Output this field as a link' and in link path put [php]
6) Go to your 'Fields' Content: Title and check 'Exclude from display'
In this way, your title of the contents will be replaced by the Global: PHP field which content is the title of the node and which link is the current url.
I'm trying to find a way to use Google tag manager to fire a tag only when a 404 page is reached. The problem is that the 404 pages do not have "404" in the URL because there is no redirect.
For instance, if you entered:
www.example.com/ofiwefoign
This is not a page on the website, and you see the 404 page telling you that the page could not be found. However, you aren't seeing www.example.com/404.
Since the URL could be anything, I need another way to get the tag to fire. I apologize if this question seems silly, but I'm having a hard time figuring it out.
I was wondering if I could possible track by H1 or title tag, which would include "404"
Thanks!
Yes, you can grab content from the page. Here is an example (looking at document.title):
Click on the tag to go to the Edit Tag screen.
On the right, under Firing Rules click on the + Add button.
Select Create new rule.
For Rule Name, name your rule something like "404 Page".
Under Conditions select "New macro..".
For Macro Name name the macro something like "404 title tag".
For Macro Type select "Custom Javascript".
In the Custom Javascript textarea, enter the following:
function () {
return (document.title.indexOf('404')!=-1)?'true':'false';
}
This will return a string value of "true" if the title tag contains "404", or "false" if not. You didn't specify what your title tag actually looks like, so you may need to adjust this to fit what you expect your title tag to contain.
Click Save to save the macro details, and you should now see {{404 title tag}} in the dropdown back on the previous screen where you are creating the rule.
Set the operator dropdown to equals and in the text field to the right, enter in "true" (no quotes).
Click Save to save the rule.
Click Save at the bottom of the Edit Tag page to save the tag settings.
On the top-right of the tag overview page, click Publish to publish the changes, and you should be good to go.
As you probably already know, I'm working hard on some XPM templates with Razor. I've ran into another issue, this time concerning rendering components inside templates in order to make them siteEditable.
The following I'm not sure about. I've got a component which has a title field called "Title", and multivalue componentlink fields which consists of components with a title, description and image. Let's call this one "Linked USP" for now.
Currently this is being rendered by a Template called 'Page Banner', and it just iterates over fields with some If-loops to determine it's presentation, especially for the Title. In order for XPM to work, this template needs to render the component presentation of "Linked USP". So we've created a template called "[XPM] USP ITEM". - this Component template has the 'enable content editing TBB" added to it.
Now the issue arises when I want to make the Title Editable as well. Sounds straightforward, no? Not really - because when the parent template has got a "enable for content editing" TBB added, it will add <span> tags to all editable fields but the templates that gets invoked inside this template will also have <span> -tags, effectively bloating the html and making it impossible to edit the fields inside the RenderComponentPresentation because of duplicate <span>s.
Some code for your fun and to illustrate my issue:
<h1>#RenderComponentField("Title", 0)</h1>
#Foreach(var linkedUSP in Fields.USPS){
#RenderComponentPresentation("linkedUSP.ID", "tcm:10-1076-32")
}
This template has an enable Content edit TBB added.
now, for the RCP mentioned above, inside its [XPM] template:
<div class="title">#RenderComponentField("Title", 0)</div>
<p>#RenderComponentField("Description", 0)</p>
<tcdl:ComponentField name="img">
<img src="#img" alt="img.MetaData.alt">
</tcdl:ComponentField>
This one ALSO has the "Enable Content Edit" TBB added. On the front end this happens:
<div class="title"><span><span>Men</span></span></div>
Because the parent template also adds spans to the field.
So my question: how do i solve this? The Title field mentioned above has to be inside the parent template, but I can't create a special template for it becuase it is no component link. I can't get the TBB out of my RCP template, because it won't be editable that way. Interesting huh?
Can't I disable the spans inside template builder somehow?
Am working on a Symfony2 application whose among its functions will allow the user to select to visit different sections of the site, and this from anywhere (any page) of the site. For simplifying let's say: when a user want to sort he/she choose from a drop down select form and submit.
I built the action and template with a test root to verify this function and this work (when I use directly the rendering of that sortAction() on my app_dev/test adress.
The issu is that when I try to make this action accessible from the general template (app/Resources/views/base.html) I can view the select form with default view, but when I select for a sort and try to Submit page relaods and return to the defaut view.
I use {% render "MycompanyMybundleBundle:Mycontroller:sort" %} in .../base.html and I want this action to work on (like) mysite/anypage this last extending bundle layout which (layout also extent base).
Can anyone help me?
The description of your problem isn't realy clear, but I think the problem lies at the form action. Do you've configured this action? You should leave it empty if you want to submit it to the same page.
Another solution would be to make use of the extending posibilities of Twig. Define the form as a block in the parent, and override it in the child.
http://twig.sensiolabs.org/doc/tags/extends.html
EDIT:
You could make the form action a block, that is what I mean...
<form action="{% block formAction %}defaulttargetpage.php{ %endblock% }"> <!-- formcontent --> </form>
I am placing a form inside a block in drupal with the following code
function current_posts_block_view($delta = '') {
$elements = drupal_get_form('mydeveloper_simple_form');
$block['content'] = drupal_render($elements);
}
This block is displayed in footer. The form has required field validator in it. So if I submit the form with no data the validator will work and error is displayed, in the default place in the node where the error will get displayed. (on the top of the page)
I want it to be displayed inside my block. What should I do for that?
The reason is that, all errors, information, and status messages are displayed where you have set in the page.tpl.php in your theme.
You can try Inline Form Errors module, http://drupal.org/project/ife/ , to fix this.