Kohana 3 Bulletin Board - kohana-3

I have a site based on Kohana 3 framework. I want to integrate some bulletin board to it. I want to see boards in < div > tag of my site. And want to use accounts of this BB as my site accounts.
What way i must follow?

Have you tried Request class?
http://techportal.inviqa.com/2010/02/22/scaling-web-applications-with-hmvc
Maybe something like this in your view:
<div id="mybulletin"><?php echo Request::factory('myurl/method'); ?> </div>

Related

Sending entry data to embedded template

I have a basic ecommerce site which has a products page, in which a full overview of the products is displayed, including thumbnails, brief description, etc. On the same page, and other pages on the site, there is a sidebar which lists the products by title only.
Since the sidebar is reused around the site I want to set this as an embedded template.
With this setup, must I retrieve all the products from the database twice; once in the main Products page, and again in the sidebar? Or is there any way to speed things up on the Products page by retrieving the entries once in the parent template and passing them to the embedded page?
For example:
products parent template:
<html>
{exp:channel:entries channel='products'}
// display full product info
{/exp:channel:entries}
{embed='includes/_products_sidbar' data={entries}} // ^ Can I pass all the data from the above loop to this embedded template?
</html>
embed:
{if data}
// if we already have the data available then use it without having to get it all again from the database
{else:if}
// if not then use another entries loop:
{exp:channel:entries channel='products'}
// display a list of products
{/exp:channel:entries}
{/if}
I think you are better of using a different approach. Have a look at layouts:
https://docs.expressionengine.com/latest/templates/layouts.html
or, if that's not possible, you can use stash https://github.com/croxton/Stash too.
oh yeah, you'll get better help on https://expressionengine.stackexchange.com/

How Can i add the customized section to home page in broadleaf

Hi I am new to broadleaf and i want to add the customized products to home page of broadleaf like the home page will load two cateogries of products at at time for example the home will want to load top sale products and hot sauces.
Please help me to Solve the issue.
Thanks in Advance
First off, i am not that experienced with broadleaf either, but my background has made it pretty easy for me to wrap my head around ( i think), and there are a quite a few different ways to do this and it really depends on how you ultimately like to maintain the lists, and your experience level.
As you have said you are just getting started, i'll give you what i think is the most simple way to do this.
First, assuming you are working from a recent version of the demo site. In this case, the home page is actually just a category with a custom template. If you look in the Admin app at the "Home" category and select the "Products" tab, you will see a list of the 4 Hot Sauces that are displayed on the home page in the Demo store.
The important thing to note here is that it is specifically not the "Hot Sauces" category, it is a specific subset that is selected in the admin app, giving you control of the not only the items displayed but the number of items displayed.
If you have seen the code in the homepage html template, you will see something like:
<div class="row">
<h3 class="text-center">
The Heat Clinic's Top Selling Sauces
</h3>
<th:block th:if="${products}" id="products" class="group" th:each="product : ${products}" th:object="${product}" >
<div class="col-sm-6 col-md-3" th:if="${product.isActive()}"
th:include="catalog/partials/productListItem">
</div>
</th:block>
</div>
This is the code in the demo site that is displaying the list of hot sauces on the home page. The CategoryController retrieved ths list of products for the category and put them in the Model.
Now, the absoloute easiest way to add a second list of products to the home page is use the same technique. In Admin look at the "Marketing" tab, you will see the same list of 4 products in the "Featured Products" section. As far as I am aware this is not actually being used in the new versions of the demo site. Note that there is also the upsell and xsell product lists, but for this purpose i am just going to use the Featured Products list. I suggest you change these to some other products now just so you can see the changes to the home page are pulling the correct list later.
In homepage.html insert something like the following code (it's similar to the code you looked at above):
<div class="row">
<h3 class="text-center">Top Selling Products</h3>
<th:block th:if="${category?.featuredProducts}" id="featuredProducts" class="group" th:each="featuredProduct : ${category.featuredProducts}">
<div class="col-sm-6 col-md-3" th:with="product=${featuredProduct.product}" th:object="${featuredProduct.product}"
th:include="catalog/partials/productListItem">
</div>
</th:block>
</div>
And your done.
This is certainly not the only way, or even the best way, unless your definition of best is "It takes 5 minutes and 6 lines of HTML".
At some point, depending on how your requirements pan out, you may end up creating a specific HomepageController, this approach should still work in that case, without customising the admin interface, as long as the data is still put in the model by the controller.
FYI: The homepage template is located at site/src/main/resources/webTemplates/layout/homepage.html

add a custom view to JHipster app

Is there a Yeoman way of creating all the necessary templates required when adding a new view in a JHipster app? I want a simple static page, or a page that doesn't require a new entity. Let's say I want to add an "About" page, I believe I would need to do the following:
Add the "About" link to src/main/webapp/app/layouts/navbar/navbar.html:
<li ui-sref-active="active">
<a ui-sref="about" ng-click="vm.collapseNavbar()">
<span class="glyphicon glyphicon-wrench"></span>
<span class="hidden-sm" data-translate="global.menu.about">About</span>
</a>
</li>
Create the following new files:
src/main/webapp/app/about/about.controller.js
src/main/webapp/app/about/about.html
src/main/webapp/app/about/about.state.js
src/main/webapp/i18n/en/about.json, and any other language...
... and add the following lines in webapp/index.html:
<script src="app/about/about.state.js"></script>
<script src="app/about/about.controller.js"></script>
... and any necessary content to src/main/webapp/i18n/en/global.json.
Am I forgetting something?
Does this need to be done manually? Is there a Yeoman command for creating a new view that is independent of an entity? I know that this question has been asked, but I'm hoping that things have changed since then.
The jhipster module Nav Element do it automatically for us. In addition it creates an angular component too for the new item in the menu.
Here is instruction how to add static page:
https://codefitter2.blogspot.com/2016/09/how-to-add-new-menu-and-static-page-in.html
You may try creating an entity without any fields or relations and with "--skip-server" option.
yo jhipster:entity about --skip-server

rendering Liferay page URLs inside of portlets Liferay 6.1

I'm new to liferay and I'm almost positive this is blazingly simple to do: Using velocity markup, I want to be able to generate links to pages within my Liferay website and embed them inside of my portlets on different pages.
I have a vague idea of how it might be done so I searched around figuring it would be posted somewhere, but I can't find anything on it. Incidentally, I want to put whatever code I come up with inside the view.jsp of the portlet. I would use velocity markup here but I don't think (don't know for sure) if that is allowed inside of a jsp.
Please let me know if you need more information to respond.
I would use velocity markup here but I don't think (don't know for sure) if that is allowed inside of a jsp.
Why would you want to use Velocity mark-up inside a JSP (view.jsp)? I don't see any advantages in doing that apart from the argument that you are really great at velocity.
Though here is a link that would help you embed velocity inside of JSP.
Note: In my opinion it is not a good practice to embed velocity within JSP in a portlet
In JSP:
You will need a Layout object which you can get with the help of static methods in LayoutLocalServiceUtil.
After you get the Layouts, you can use the static methods of com.liferay.portal.util.PortalUtil like getLayoutFriendlyURL or getLayoutFullURL etc to build the URL.
In VM (these would be *.vm files in themes):
You can follow all the same steps as mentioned in JSP. The things you would need to do that are:
Instance of LayoutLocalService, can be found out by using the following code (taken from this answer):
#set($layoutLocalService = $serviceLocator.findService("com.liferay.portal.service.LayoutLocalService"))
now you can use the velocity variable $layoutLocalService to make calls to service methods for getting the layouts.
Then you can call methods of PortalUtil class by using the variable $portalUtil available for *.vm files in themes.
You can check-out the following files for more details (if you are interested):
docroot/html/themes/_unstyled/templates/init.vm, this contains all the velocity variables available in themes. Variables of interest might be $theme, $theme_display, $layout, $navItems.
docroot/html/themes/_unstyled/templates/portlet.vm, this file is a template to display the individual portlets.
docroot/html/themes/_unstyled/templates/navigation.vm, contains code for displaying the navigation menu with page links.
docroot/html/themes/_unstyled/templates/portal_normal.vm, this file represents a page-template in liferay and this contains the other files like navigation.vm & portlet.vm.
For Velocity:
Okay so for generating the links for Liferay pages in velocity take a look at the following file in the Liferay source code:
/portal-web/docroot/html/themes/_unstyled/templates/navigation.vm
In there you'll see how the default Liferay theme generates the navigation structure for your site. To make life easier for you here it is:
<nav class="$nav_css_class" id="navigation">
<h1>
<span>#language("navigation")</span>
</h1>
<ul>
#foreach ($nav_item in $nav_items)
#if ($nav_item.isSelected())
<li class="selected">
#else
<li>
#end
<a href="$nav_item.getURL()" $nav_item.getTarget()><span>$nav_item.icon() $nav_item.getName()</span></a>
#if ($nav_item.hasChildren())
<ul class="child-menu">
#foreach ($nav_child in $nav_item.getChildren())
#if ($nav_child.isSelected())
<li class="selected">
#else
<li>
#end
<a href="$nav_child.getURL()" $nav_child.getTarget()>$nav_child.getName()</a>
</li>
#end
</ul>
#end
</li>
#end
</ul>
So the Velocity is looking through a collection called $nav_items, and then calls the getURL() method on each item to generate the link.
For JSP:
You'll need to make use of the LayoutLocalServiceUtil class, and in
particular one of the getLayouts() methods.You'll have to pick the one that best suits your need.
This will return the list of Layouts (your pages), and then you can
call getFriendlyURL() on each of these layouts to return it's url
This will be a relative url to your site, so something like
/my-site-home-page.
Let me know if you have any more questions!

Heirarchical Select Steps Drupal 6

I am working on a site in which there is two type of user- 'Company' and 'Consultant'. I am using content profile and auto assign role for this. in the registration of consultant i have a field to select main area and sub area (for ex-Science and Technology[as Main Area] and Biology and medicine[as Sub Area]). I want to use Hierarchical select but I am doing something wrong so it is not working.
So please either tell me the steps of Hierarchical Select or suggest me another module for this.
Please help.
Try adding this in your tpl whether you are using one.
<div style="display:none">
<?php print drupal_render($form) ?>
</div>
I use the same modules and it works.

Resources