Changing the #foreach post loop ordering to ascending in loop.hbs - ghost-blog

At the moment there does not seem to be a way to declare the post order in the loop.hbs file. Newer posts are always on top, ordered descending. Is there an easy way to change the order to ascending?

I've used jQuery .reverse as a client side solution

Related

how to rearrange tags in a widget in AEM?

How can we re-arrange tags in a widget in AEM?
For example, I have selected multiple tags, and I want to move tags up or down based on the requirement.
As per my knowledge, tagfield do not allow sequencing (not sure if latest version support this much needed feature), so i prefer to use multifeld and each multifield has one path selector to select tag.
PS. Multifield provide ordering feature.

Display content in two columns with fixed height in drupal

I'm in need of some pointing in the right direction here...
I have a site with a couple of different content types. I want to display this content in a book-like layout. The book should be of a fixed width and height and the pages should be populated with as many nodes as can fit. It should be in two columns, with the left column being filled before the right one.
How should i approach this?
I have been thinking about a few solutions, don't know which are possible and which one is best or which i can combine.
I could just create a view that selects more nodes than is need. Then check how long the nodes is in the theming layer and throw away the nodes that aren't needed. Pagers need to be fixed too.
Use panels in combination with views to display one view in two columns, if this is possible. Need a way to determine the amount of nodes that is displayed on each page, based on content length.
Write a plugin/handler for views so that i can select an amount of nodes that has an maximum, predetermined, max content length.
Write a new display-style for views that shows content in two columns with fixed heights.
Write a custom module, leave views and panels out of it and do everything myself with db_queries.
Would appreciate and guidance a lot. Not looking for a finished solution, i'm not afraid to code and i will contribute back if i create something that someone else can use (like a views plugin). Just need someone to guide me in the right direction :)
The hardest thing will be to figure out how much content you need to fill out the space. There's not really a good way to do that either since, it will depend on both the markup and the styles.
The best solution I can think of is loading the nodes with javascript, or maybe just have them available as javascript variables. That way you could insert the nodes to your page one by one. You could then in the JS see the heights of all the nodes in total, and once that height is bigger than x, you only need to remove the last inserted node.
It's not a perfect solution, but I think you should look at doing this with JavaScript. The only problem is, that it wont degrade gracefully very well.
Drupal help you build fast, and it looks like promising but fails to fullfil the needs of client, designer also programmer. You need to write one module page, and some functions.
5th solution you gave has little trouble than others. Write a function that to have "teaser like" behavior, I will return formatted node according to its type. Don't lay on drupal's teaser system. If teasers will have different heights, add height to teaser function.
I don't have a direct answer, but have a few things for you to think about.
It sounds to me like what you are looking for is a combination of a CSS3 Multicolumn Layout (see http://www.quirksmode.org/css/multicolumn.html for example) and limiting the displayed content to a fixed height.
My first thought would be to create a single view that gets more than you need, display it using CSS3 columns, and set overflow: hidden; for the container, so that the extra text is just hidden.
If you need to get more particular, you may need to dig in to the views rendering system to limit the total number of nodes based on how many characters have been rendered.
But since your desired constraint is more visual than data-oriented, I think that the most practical approach will be to use javascript to detect the text height and state of overflow.
There are some things that are unclear about your requirements. What is the purpose of the 2 content types? Does one display on the left and the other on the right? Or are these just 2 different content types that should behave the same way, but we're only seeing one content type at a time on a given page? What should happen with the overflowed content? Should it appear dynamically on page 2, then 3, then 4, and so on?
One parting thought: Maybe load ALL the content that you want to page through, directly to the browser. Maybe have it start off hidden. Then use javascript to display it, formatted into columns, and use javascript to handle the paging as well.

filtering a Drupal View with ORed criteria

I'm attempting to present a Drupal View that shows nodes in which the user's e-mail address shows up in one of two CCK text fields. Unfortunately, this doesn't seem to be possible using the stock version of Drupal's Views module - there doesn't appear to be a way to combine filtering criteria (except ANDing them), nor does their appear to be a way to do the custom logic for the filter's setting...
Is there a simple way of directly injecting additional information into a specific View's WHERE clause? If not, can it be done in another way?
You can use the views_or module. It's still in dev but looks promising.
The other option is using hook_views_query_alter with $query->add_where() you should be able to add an or clause. You can also use it to add your aditional WHERE clause that you asked for.

Drupal views: Allowing users to choose sort criteria on node display

I have some nodes I am displaying in a view. They are displayed as nodes, unformatted. I would like the user to be able to choose from some predefined sort criteria ( via drop down list or similar).
So they could pick recently active, most commented, newest, etc., and re-query for new results.
Its easy with tables because you can make the labels clickable, but I do not know how to have similar functionality with a raw node preview display.
Just a thought, from me to me, and for anyone else who may be trying to do this.
An easy, sleezy option would be to just add another page view for each of the required sorts, and provide a link to these other views in the header of each of the pages.
This could also allow for (easier) linking to the individual sorts, so say if you have a sidebar block displaying recently commented nodes, you could adjust the .tpl.php of the block to have the title link to the view displaying the full set of recently commented nodes.
also im pretty sure there should be a way to do this with arguments, but i dont know how
Views 3 supports exposing sort order (just like you can expose filters)
Select the sort order (e.g. add sort by node creation date, then click on the settings for that), you should be able to expose the sort order to the end user. This is just like clicking on the settings for a filter and then choosing to expose it.
Standard views isn't going to support this, so IMO you're best off implementing a custom solution using just a plain old view and this jQuery plugin. You can either do this at the theme layer (the same way as any other JS in a theme) or a custom module (via drupal_add_js() to add the plugin and your bit of custom code). Either way will work, although the custom module has the obvious benefit of being theme independent (and thus more portable).
If you go the custom module route, please consider releasing it as a contrib module on http://drupal.org.

Dynamic Select in Drupal

In my way of learning drupal, I got stuck in this issue. I have Taxonomy vocabularies that I set as tree with each node have different depth. Now, I need to display it in select box in a way that only one select(the parent terms) at first. On change, it will fetch term's children and display another select box below it. This goes until the last term doesn't have any children.
How do I do that in drupal?
I'm not sure I understand the question, but I think Hierarchical Select could help if this is a question about the UI
not so clear question, may be using http://api.drupal.org/api/function/taxonomy_get_tree/6 will be helpful.
[edit]
You can use the depth parameter to make sure that you only have the top level items in your first select. Then you can (through an ajax callback) get sub items using the parent parameter.

Resources