I've been scratching my head like crazy over this all day, there seems to be a hundred different ways to get what I want done but I want it done a certain way - which I can't find.
Here's what I'm working on: http://schmidtbrotherscutlery.com/dev/mySchmidt/myCutlery/
My setup is one view with four different pages, each filtered by category. Default page above lists all three categories at once, and the Category sublinks in the menu take you to the three other view pages that are filtered by a single category. What I need is each of the category sublinks to load their respective view pages with AJAX instead of page by page refresh like it is now. I realize I can effectively achieve the same thing with an exposed filter on the categories but I want these specific menu sublinks to load the view pages, not filter one view on it's own with an exposed form. This really doesn't seem to be that difficult and I don't know why I haven't been able to figure it out yet but I don't have much experience with Drupal+AJAX integration. Help please!
From what I've read it sounds like you should be able to put each of the views within a jQuery tab container. So for example:
<div id="tabs">
<div class="tab">
<?php views_embed_view('viewname', 'block_1')?>
</div>
<div class="tab">
<?php views_embed_view('viewname', 'block_2')?>
</div>
<div class="tab">
<?php views_embed_view('viewname', 'block_3')?>
</div>
</div>
This would allow you to cycle through each content piece without refreshing the page.
Related
I'm working on a news publishing site that needs to load in stories from an RSS feed below the current news page. I've been using InfiniteAjaxScroll (http://infiniteajaxscroll.com/) to some success however, I've hit a brick wall. There is not way for me to dynamically change what story should load in next as you scroll down the page.
Does anyone know of any other plugins, tutorials, examples that replicate behavior like this. I've searched but come up with nothing that meets these requirements.
I'm trying to create something similar to what the Daily Beast has implemented on their site.
http://www.thedailybeast.com/articles/2014/11/05/inside-the-democrats-godawful-midterm-election-wipeout.html
How do they know what stories to load in?
Thanks!
If you're using the InfiniteAjaxScroll library, the "next story" is whatever link you define as the next URL which can be dynamic for each story you load.
Imagine your first story's HTML as something like this
<div class="stories">
<div class="story">
...
</div>
</div>
<div id="pagination">
next
</div>
Then in the storyC.html you have
...
<div id="pagination">
next
</div>
Assuming you're using some sort of dynamic backend, you would use some sort logic to grab a related story and just set that URL as the "next" URL.
I tried this code:
{block:Posts}
<ul>
{block:HasTags}
{block:Tags}
<li>{Tag}</li>
{/block:Tags}
{/block:HasTags}
</ul>
{/block:Posts}
However when you click one it takes you to another page. How can I make this sort them without going to another page?
Example of the sorting I want to achieve: http://purifytheme.tumblr.com/
I have 3 divs parallel to each other holding some information. I want three new divs, in the same position as the previous ones (refer image), take the position of the last ones while pushing the same downwards.
I want this action to happen dynamically i.e. when someone enters information on the back-end module, the more recent information takes place of the older one.
I am pretty new to Ajax and jQuery but I am sure this is the way to go. Can someone please direct me to a suitable direction?
Image: http://img12.imageshack.us/img12/4149/us56.jpg
You are right, Ajax and jQuery can be the way to go.
Simplest solution is probably to put the three blocks into one div and call
$("#parent-div").prepend();
on it. You can arrange the blocks how you want using CSS
<div id='parent-div'>
<div class="col left">Hello World</div>
<div class="col">Hello World</div>
<div class="col">Hello World</div>
</div>
Tried it out on jsFiddle, just have a look.
http://api.jquery.com/insertBefore/
example:
$('<div>new div</div>').insertBefore('#divName');
Hi I'am working for sone time with wicket and in my team we argue a lot abot the place that should be given to the design
I think that design should be only in markup in order to achive separation of concernes where others think what i am doing is a boiling plat code
for example we are using this structure to support IE8 usung round corners with pictures :
<div class="panel-wrapper">
<div class="panel-left"></div>
<div class="panel-right"></div>
<div class="panel-bottom"></div>
<div class="panel-top"></div>
<div class="panel-bottom-right"></div>
<div class="panel-bottom-left"></div>
<div class="panel-top-right"></div>
<div class="panel-top-left"></div>
<div class="panel-bg"></div>
<div class="panel-body">
//stuff
</div>
i think that allthoght it's against my belives as a developer this is the best way to achive mvc , to separate view from controler where others say that we should write this code once in wicket panel an derive from the wicket panel
what if tommarow this component would be in another place and the given markup would couse us problems such as using #override getVaration?
Why not use Behaviors?
Keep your component clean by putting the basic layout into the template but use AttributeAppender/AttributeModifiers to add CSS-Classes.
I think it's a good idea to allow designers (who should know about css and semantic markup) to create a static version of your page, then you can decide how to construct the panel and then "wicketize" your panel's markup. I think that's the role designers and developers can play.
Often when deciding how to create a panel, one might be concerned about "what if the markup changes"?.. Well, that's the reason why is useful to know the road map of your website and see how it can be reused. In my case, what I usually do is create an abstract panel with no markup and then start extending it, instead of creating styles and stuff like that, because that usually leads to changes in the panel every time you need a different style when you change the behavior of you panel depending on the style. If you think an abstract panel can be overkill, you can create a default panel with the markup that might get used the most and extend when necessary and use different markup for that new panel.
I have a basic cms that loads content into pages that have mustache tags to indicate where in the html code those contents will appear.
The contents are specified in a widget model which indicate which type of content is to be displayed, so for example, freetext with id. or another model and id. each one of those models will be displayed differently based on the model they are based on.
I can imagine this becoming and bit unwieldy, is there a way to have a separate folder to put those widgets in so that it doesn't clutter my main code.
Something like apotomo does on rails would be good, but for codeigniter.
A widget model? That is not so nice. Have you tried looking at PyroCMS?
https://github.com/pyrocms/pyrocms/blob/master/system/pyrocms/modules/widgets/libraries/Widgets.php
From the sound of it you may be more interested in our Plugins library (sounds like the same thing with a different name). It is set up with a MY_Parser and runs on top of Dan Horrigan's Simpletags implementation.
Either way this has all be done plenty. If you want some more specific tailored advice you might have to demo some of your code.
Create a folder inside application/views called widgets. Put your widgets inside that folder and create a separate file for each widget (d0h).
Next, you have 2 options (at least that i know of):
a.) Load the widgets into variables inside the controller, then pass them to the main/general view
$data['widget_twitter_feed'] = $this->load->view('widgets/twitter', '', false);
$data['widget_something'] = $this->load->view('widgets/something', '', false);
$this->load->view('my_main_view', $data);
b.) Load the widgets inside the main/general view itself
<html>
...
<div id="sidebar">
<?php $this->load->view('widgets/twitter'); ?>
</div>
...
<div id="footer">
<?php $this->load->view('widgets/something'); ?>
</div>
...
</html>