I have a user profile page with a sidebar menu with links which I would like to render/display into the main content area upon clicking any one of the links without the whole page re-rendering. Any ideas as to the best way to go about doing this task?
You could use a front-end framework like AngularJS or Ember. If it is static data or very simple, you could use the tabs functionality built into jQuery: https://jqueryui.com/tabs/
You're asking a basic iron-router question. If you follow the iron router tutorial you'll see how to render a route into a template. On the links in your sidebar/nav you would use {{pathFor 'myPath'}} and that would automatically pump the myPath template into the {{> yield}} of your layout without re-rendering. With iron-router and Meteor you basically never re-render.
An alternative is to just render all the divs in your layout and hide/show them based on nav item clicks. You can even do that without javascript using bootstrap.
Related
Just like we have _app.tsx and we can receive a Component in props dynamically according to the route, can we have another page at a different level with the same kind of functionality?
Here is an example of what I require:
My App page has a static header and dynamic body. The static header has links, when a link is clicked the body changes according to the route. With _app, this works perfectly fine. However, there is another page called Settings which shows in the body of _app. In Settings page, there is another level of routing. This page has further two sections; a NavBar and a body. The NavBar has links and when the user clicks in one of the links, the subroute changes accordingly.
I understand that one way this can be acheived is to add NavBar to all the subroutes of Settings page but I am looking for a better way.
How is this possible?
I'm Laravel Newbie.
I would like to convert my Dreamweaver template to Laravel Blade.
There are a header, left-sidebar and right-content.
The header has a navigation bar with dropdown function.
Each navigation bar button is the one category.
Once click on the button, the sidebar will change.
Diff category has their own sidebar.
Each sidebar contains submenu.
Is it not only Blade's topic but also CSS topic?
Please advice.
It's Blade, CSS and probably backend topic as well (depending on what's powering your site at the moment).
You could create a master template (where you'd place header, footer, etc.)
A template for the sidebar and another template for the main content (these two templates would come included in your master template).
Is there a way to easily implement accordions in Drupal 8.
Till now, i've done it with field collection (or paragraph) but my client wish to can put an accordion everywhere in a content where he want. with the fields, i need prepare it on the template.
So i think on something like a shortcode known in WordPress:
[accordion]
[accordion-item id="item-1" title="Title of accordion item"]Drop-down content goes here.[/accordion-item]
[accordion-item id="item-2" title="Second accordion item"]Drop-down content goes here.[/accordion-item]
[accordion-item id="item-3" title="A Third accordion"]Drop-down content goes here.[/accordion-item]
[/accordion]
Or is there maybe some kind of a page builder module for Drupal which allows that and gives a bit more flexibility creating the content?
Thanks for any advice.
Ok so here's a very custom solution (not as easy as requested), but still, I guess I'd do it this way. You'll need FieldGroup module and theme preprocesses knowledge.
Add an extra field in your form(s). It will be a Fieldgroup of a titre input and a body textarea. Configure it so the user can add an infinite amount of elements.
Now lets say you add this token in your wysiwyg : [accordion].
In you theme, create a preprocess function for your node (THEMENAME_preprocess_node), and get the wysiwyg content. Search for the token, and if it's there, place the Fieldgroup content there.
Don't forget to hide the Fieldgroup content on the display.
Finally, in your theme, add an accordion library (or jquery-ui accordion from the core) and apply it on your injected html.
It should do the work.
Edit : You can also go with Views Accordion. But I think it would be a less interesting solution for your client UX.
sir
I'm new to the drupal. I want to put twitter button in my drupal 7 web site in the footer.I use twitter button code to html.tpl.php file and i put code to the below the page bottom ().It works correctly.But button it display below the footer in my site.But i want to display twitter button in the footer.How can i do this.
I want only the log to my site's twitter page when clicking button.
this is the code which i use (https://twitter.com/about/resources/buttons#follow)
Follow #twitter
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
thank you
You're best off using the Twitter Follow Block module or Follow Button module or a similar one to do this for you. They'll each give you a block which you can then place wherever you want, without having to manually add the code to your template. You can then just go to the blocks page and move it to the region you wish to place it in and order it relative to the other items in that region using the drag handles on the left.
If you really want it completely custom coded in yourtemplate, you're probably looking for page.tpl.php, not html.tpl.php. You won't have as much control over placement, though.
I have enabled Answers module and really like the "questions/start_ask" page.
here are my questions
i am not able to identify what is this page - a view, custom form or some Panels template -
how do i use this in the header REGION as a widget or a custom block?
Do you have the Devel and Theme Developer modules installed? If not, get them. When they're turned on you can click "themer info" in the bottom-left corner of any page, and then hover over anything on the page to find out about the functions, views, and templates that were called to create it.
Fixed - I got the form working in my header by adding a new region in page.tpl and then
<?php print drupal_render(drupal_get_form('answers_start_ask_form')); ?> + some css to position and color things.
you can see it working here www.onlinedoctors.in