Is there any way to control/route content by referrer value in Expression Engine? - expressionengine

Let’s say that I have a carousel on my index page.
Inside the template for index, it loads a particular channel, “Foo”
<div "slider">
<ul class="slides">
{exp:low_reorder:entries set="foo" dynamic="no"}
<li class="foo_{entry_id}">
<div class="container">
<div class="row-fluid">
<div class="span12">
{foo_html}
<style type="text/css">{foo_css}</style>
</div>
</div>
</div>
</li>
{/exp:low_reorder:entries}
</ul>
</div>
That channel, naturally, has a list of content items
I want the list of content items displayed to exclude one of the items in the channel if the referrer is not bing.
Can anyone show me the way that they would go about accomplishing that? I'm not getting any traction on the ellislab forum.

I whipped up a plugin for you, which you can find here
You can wrap the item in a conditional using that plugin to check if it should be output.

Related

Liferay 7.3: How can I use custom ADTs in a page template?

I want to have ready components for a page, when a page template is used. E.g. when I create a page using subpage-1 template, it'd give a place to drop a banner image (or leave a template image) and add breadcrumbs automatically (no need to customise).
They both have custom ADT, which I can't seem to find from the Page Template options. (It seems to have it's own "site" in the admin bar, when editing the template, so my guess is it doesn't find anything from my main site.)
Is there a way to get the custom ADTs for the page template? For clearance, the route to the template is Site Builder --> Page Templates --> New Collection --> New page template.
Possible workaround?
This is my subpage-1-column.ftl code, which has two dropping places: One for the banner image and breadcrumbs (which I would like to have automatically placed) and the other for the other stuff. Is it possible to add all the things here, that I want my page template to do (content place, type, adt...)?
<div id="main-content" class="container-fluid subpage-1-column">
<div class="portlet-layout row no-gutters">
<div class="portlet-column portlet-column-only col-12" id="column-1">
${processor.processColumn("column-1", "portlet-column-content portlet-column-content-only")}
</div>
</div>
<div class="portlet-layout row no-gutters">
<div class="portlet-column portlet-column-only col-12" id="column-2">
${processor.processColumn("column-2", "portlet-column-content portlet-column-content-only")}
</div>
</div>
</div>
Promoting a comment to answer:
ADTs can live in global scope, there they're independent of a "current site".
Downside: Global means global and comes with the general downside of anything global. In this case, I believe that it's not much of a problem, but you'll have to validate that for yourself.
My recommendation is to look at Content Pages / Master Pages though, as they're a lot easier to edit than Freemarker Templates.
In your comment you say that Master Pages "destroy" your footer, header etc, which they're not supposed to do and I wonder about the root cause there. But anyway: You seem to have your ADT already, and global scope seems to fix your issue. I'll leave it at that. Going after the Master Page issue's root cause would be a different question (but might no longer be programming related)
If you're looking for a code template for the possible "workaround":
<div id="main-content" class="container-fluid subpage-1-column">
<div class="portlet-layout row no-gutters">
<div class="portlet-column portlet-column-only col-12" id="column-1">
${processor.processColumn("column-1", "portlet-column-content portlet-column-content-only")}
<#assign portletPreferences = { "displayStyle" : "ddmTemplate_ADT_CUSTOM", "portletSetupPortletDecoratorId": "borderless", "headerType" : "none", "delta" : "10", "paginationType" : "none" } />
${processor.processPortlet("com_liferay_asset_publisher_web_portlet_AssetPublisherPortlet", portletPreferences)}
</div>
</div>
<div class="portlet-layout row no-gutters">
<div class="portlet-column portlet-column-only col-12" id="column-2">
${processor.processColumn("column-2", "portlet-column-content portlet-column-content-only")}
</div>
</div>
</div>
This will add an AssetPublisher to your first column with a specific ADT (ddmTemplateKey = ADT_CUSTOM)
To see all available portletPreferences check your database or copy the following code in one of your ADTs:
<#list portletPreferences?keys as prop >
<li>
${prop}
</li>
</#list>

ejs with progress bar

How to define or update style="width:<%=MettingPer %>;" for progress bar in ejs
<li class="list-group-item d-flex justify-content-between align-items-center">
Meeting
<div class="progress">
<div class="progress-bar progress-bar-striped bg-success progress-bar-animated" role="progressbar" style="width: 75%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100">
<%=MettingPer %>%</div>
</div>
</li>
EJS is rendered on the server, not the browser, so EJS has no idea what document is since that's something that's only defined in the browser.
So for this you need to load your page completely on the client side with zero value.
Then complete it according to the instructions in JavaScript.
And as soon as you receive a response from the server, complete and hide it with a little delay.

Buildfire: How to remove the "saved" part?

I could use some hints to get rid of the SAVED content in the coupon Plugin -
Screenshot of the area i want to remove
Thanks in advance!
O.
In the file widget/templates/List-Layout-1.html file you will see the following code:
<div class="col-xs-6 pull-left text-center primaryBackgroundTheme">
<a class="whiteTheme stretch" ng-
click="WidgetHome.showSavedItems()">Saved</a>
</div>
You can just update it to the following:
<div class="col-xs-6 pull-left text-center primaryBackgroundTheme">
</div>
The widget has 4 layouts, so depending on the layout that you want to use, you need to make sure to update the appropriate template.

MODx Revo Wayfinder 3rd level <ul> different to 2nd level <ul>?

I've used the Wayfinder menu building extra with MODx Evo and am now attempting to use it with MODx Revo for a new site. It's working well apart from I can't yet see a way to have the 3rd level different to the 2nd level . See the way Wayfinder is currently outputting the menu (simplified here for clarity):
<ul class="nav nav-pills nav-main" id="mainMenu">
<li class="dropdown">
<a class="dropdown-toggle notransition" href="index.php?id=200">
Help
<i class="icon-angle-down"></i>
</a>
<ul class="dropdown-menu pull-right " style="display: none;">
<li>
<a href="index.php?id=31">
FAQs
</a>
</li>
<li class="dropdown-submenu pull-left">
<a href="index.php?id=54">
Policies
</a>
<ul class="dropdown-menu pull-right" style="display: none;">
<li>
<a href="index.php?id=490">
Privacy Policy
</a>
</li>
<li>
<a href="index.php?id=489">
Terms and Conditions
</a>
</li>
</ul>
</li>
</ul>
</li>
</ul>
I need the 'Policies' sub-menu, with 'Privacy Policy' etc, to pull to the left, not to the right - defined in Wayfinder InnerTpl:
<ul class="dropdown-menu pull-right" style="display: none;">[[+wf.wrapper]]</ul>
So, is it possible with Wayfinder to have a 3rd level different to the 2nd level ???
I've browsed the docs and forums for days to no avail and hope that the amazing SO community has some insights. Thanks in advance!
I think you are going to have to do this with CSS, you can add the &levelClass to your wayfinder call [docs say " CSS class denoting every output row level. The level number will be added to the specified class (level1, level2, level3 etc if you specified 'level').]
that way when you can write some css for your third level items when you see something like:
<li class="dropdown-submenu pull-left level2">
your css could go something like:
li.dropdown-submenu.pull-left.level2 > ul {
/* css for pulling it right */
}
unfortunately the &levelClass does not do anything if you add [[+wf.classnames]] to the UL tag in the outer wrapper so you have to come at it sideways.
OR
your inner wrappers could be written to use a snippet to decide what classes to add:
<ul class="dropdown-menu [[!pullLeftOrRight? &id=`[[+wf.docid]]`]]">
[[+wf.wrapper]]
</ul>
Then in your snippet use the docid to determine where in the menu tree that subnav is.
[hopefully docid is available in the outerTpl - I'm not sure]
UPDATE
After reading your comments & the docs again, I think I have an idea that might work - check out the &categoryFoldersTpl attribute, setup your tpl for that with your pull right classes & for your 3rd level drop downs, set the rel="category" on only the third level resources as suggested in the docs. [which doesn't help anyone who wants different submenus for different levels, but may get you out of your bind]

expression engine: Content in channel fields don't show up on the webpage when called in a template

I have a snippet called sidebar with the following code.
<div id="ebook_offer">
{exp:channel:entries channel="test"}
<h3>Ebook</h3>
{/exp:channel:entries}
</div>
<div id="about_blog">
{exp:channel:entries channel="blog_sidebar"}
<h3>About Obsia's Blog</h3>
{/exp:channel:entries}
</div>
<div id="testimonials">
</div>
<div id="demo" dynamic="no" limit="1">
</div>
<div id="recent posts">
{exp:channel:entries channel="blog" limit=5 offset=1}
<h3>Recent Posts</h3>
<li>{title}</li>
{/exp:channel:entries}
</div>
<div "connect">
</div>
<div = "subscribe">
{exp:mailinglist:form list="blog_list" form_id="blog_subscribe"}
<h3>Subscribe</h3>
<p>First Name <input type="text" name="first_name"="{first_name}"></p>
<p>Email <input type="text" name="email" value="{email}"></p>
<p><input type="submit" value="submit"></p>
{/exp:mailinglist:form}
</div>
This snippet is called inside the index.php template for blog template group and the code is as follows:
<div id="blog_display">
{exp:channel:entries channel="blog" limit="5"}
<h2>{title}</h2>
{author}
{if blog_images} <img src="{blog_images}" alt="blog image {title}" class="some_class" />
{/if}
{teaser}
<p>comments {comment_total} </p>
{/exp:channel:entries}
</div>
{sidebar}
I also have channel called sidebar with fields such as ebook_offer, about_blog, recast posts, testimonials, subscribe. I can get the subscribe forms to show up. I can see recent posts on my webpage but can't see any of the content that has been filled in about_blog field.
Anyone know why blog channel works but not my sidebar channel.
I'm not quite sure what the problem is exactly without having all of your code in front of me, but it could be a few things. For starters, if your blog homepage template has an {exp:channel:entries} tag in it, and you're including the snippet inside of that tag, you'd run into problems. You can't nest an {exp:channel:entries} inside of another.
Also, channel entry tags are set to dynamic by default. They will look at the URL for hints about what entries to pull from the database. Try adding the dynamic="no" parameter to your sidebar entries tag, which you can learn more about here. This should make the tag ignore the page's URL, which is what you want. You might also want to add the limit="1" parameter to that tag as well, to ensure that only one sidebar entry is being rendered.
Please let me know if neither of those answers help!
The best strategy would be to move what's in your snippet into a separate template file while you try to figure this out. I noticed a couple of things that seem off to me in your sidebar snippet code.
<div id="ebook_offer">
{exp:channel:entries channel="test"}
<h3>Ebook</h3>
{/exp:channel:entries}
</div>
<div id="about_blog">
{exp:channel:entries channel="blog_sidebar"}
<h3>About Obsia's Blog</h3>
{/exp:channel:entries}
</div>
This doesn't really seem the right way to use the {exp:channel:entries} tag. You mentioned "ebook_offer" was a channel field. But here you're using it as a static id for an HTML div. If "ebook_offer" is a field I would expect something like this:
<h3>Ebook</h3>
{exp:channel:entries channel="test"}
{ebook_offer}
{/exp:channel:entries}
Same with "about_blog"
<h3>About Obsia's Blog</h3>
{exp:channel:entries channel="blog_sidebar"}
{about_blog}
{/exp:channel:entries}
Also I noticed you said the channel was named "sidebar" but in your {exp:channel:entries} tag you're using "blog_sidebar". Which isn't the same thing, is your channel's shortcode "sidebar" or "blog_sidebar"?
Finally this is a little off to me
<div id="demo" dynamic="no" limit="1">
</div>
"dynamic" and "limit" only work on ExpressionEngine {exp:channel:entries} tags, not regular HTML elements (like DIVs). I would try using Bitmanic and Peter's suggestion again, but apply it to {exp:channel:entries} like so:
{exp:channel:entries channel="blog_sidebar" dynamic="off"}
...
{/exp:channel:entries}
If you're new to ExpressionEngine I highly recommend videos & tutorials by Ryan Ireland http://eeinsider.com/videos

Resources