Including multiple views overwrites content of other included views - laravel

I have various templates like sms.birthday and sms.account-created. They all inherit from a base view layouts.sms. On one of the admin pages, I wanted to show a preview of these views by including them with some dummy data. However, when including the views, the first one that is included overwrites the sections of all other views.
// layouts.sms
#yield('sms.content')
// sms.birthday
#extends('layouts.sms')
#section('sms.content')
Happy birthday
#stop
// sms.account-created
#extends('layouts.sms')
#section('sms.content')
Account created
#stop
// admin page
#include('sms.birthday')
#include('sms.account-created')
Expected results on admin page:
Happy birthday
Account created
Actual results on admin page:
Happy birthday
Happy birthday

Instead of using #stop, using #overwrite solves my issue.
https://github.com/laravel/framework/issues/1058#issuecomment-17194530

Related

Adding Joomla Article Order number inside an article

I am trying to create a Joomla site that would be showing the article order numbers (not Article ID) inside each article. that way I can handle it like a book.
Each page will show the article order number at the corner - like a page.
That way I will be able to have the site modeled by categories and pages will show with their page number (Article Order number) at the corner.
I want to give the user the ability to watch the pages like they are reading books by categories.
I would be happy to know - how can I add the article order number (for each category) inside the article itself.
I am sure that there is a PHP code that can do that.
Thanks so much for your help and assist.
Arye
You'll need to override the default article layout in your template.
If your template doesn't already have an article layout, you can copy the default layout from components/com_content/views/article/tmpl/default.php inside your template override templates\[YOURTEMPLATE]\html\com_content\article\default.php (replacing [YOURTEMPLATE] by your actual template name.
You can then display ordering where you require it within your template by using
<?php echo $this->item->ordering; ?>
You'll most likely want to either check for a certain condition (the article's category, perhaps) to determine whether you want to display the ordering.
Another option is to create an alternative layout instead of overriding the default one. You can rename default.php in your template to, let's say bookpage.php. You will then be able to pick the new layout as an alternative layout in your articles' options.
you can get article id by using
Request::getVar('id');
for more you can check the link
Joomla plugin : how to get article title and article id
for jquery you can do like this. you can create a function and call on every page load it will sort all your content accordingly. you can assign other attributes also in foreach loop.
<div id="allArticles">
<article id="3">Article 3</article>
<article id="1">Article 1</article>
<article id="2">Article 2</article>
</div>
$("#allArticles article").sort(function (a, b) {
return parseInt(a.id) > parseInt(b.id);
}).each(function(){
var elem = $(this);
elem.remove();
$(elem).appendTo("#allArticles");
});
more you can see the working example here http://jsfiddle.net/THMu3/

How we call "Pages" name in Dropdown in Signup form of PHPfox?

In PHPfox, i want to call "Pages" name in drop-down in Signup form. Reason for calling "Pages", Actually i have created many pages for college name & that are saved in database. So if someone comes for signup, i want to show them college name in drop-down (which are basically "Pages").
Please help me.
Thanks in advance.
You will need 2 plugins, one to show the HTML and one to process what to do with the user input:
1) Make a plugin that fetches the pages, maybe the hook user.component_controller_register_1 or another in that controller would do but otherwise you can always use a low level hook like run_start and check if its the section where you want it.
To show the HTML you have 2 options: include a JS file to populate the sign up form with anything that you want, or if you have a custom template you can just assign the array to the template variable and look through it in your template.
2) Once the html part is showing and working make a plugin for the sign up routine, I think the hook user.service_process_add_1 should be enough given its location.
Dont forget that the input name for the signup is an array, so your drop down needs to look somewhat like this:
<select name="val[my_dropdown]">

Joomla 3 Content Restriction

I have a single article and I want to display a portion of the content to the Registered user group only and the other portion to a Custom user group only.
I'm sure I read an article sometimes int he past year about doing this without a plugin (Though I may be mis-remembering the article)
Is this possible without an extension using something along these lines?
{content group=registered}
You can create a category (with limited access) say Registered. Create another category with restricted access say Paid_Access.
Now for every article create two articles - one in Registered category containing only Intro text and another full article in Paid_Access category.
Create Access Group and Access levels with same name
The hierarchy of the access levels will be as follows:
Public
Registered
Paid_Access
Set the Registered category to access level Registered. Set the Paid_Access category to access level Paid_Access
By default, on Joomla registration every user will be in Registered access level and will be able to only view article intro.
When user make some payment, move the user to Paid_Access access level. Users in this level can view the complete article.
Creating two articles for every new article may be cumbersome, to reduce this pain, you can create a custom form using ChronoForms. This form should have two text areas for the article - one would be for Intro text and another full article (without Intro text). The form while saving, will itself create two articles - one in Registered and another in Paid_Access. Thus your pain of creating two articles will be gone!
It is not possible without a plugin.
Reason : When Joomla is preparing content then there must be a function(code snipet) that detects the Text enclosed in {content} tags and decide what to do with this text and accordingly edits the content.
I have developed a Content Plugin, This will helps you https://github.com/jitendra-khatri/jcontenthider to setup your scenario.
You could do this with CSS if your template adds the access level as a class on the body or html (mine do). Though anyone with firebug or a code inspector could unhide content if they thought to look at the source.
<body class="registered">
// other code up to article content
<div id="articleContent">
// this is now in your article
<div class="hidefrompaid">
// content for registered users
</div>
<div class="hidefromregistered">
// content for paid users
</div>
</div>
...
Then your css would be:
body.registered .hidefromregistered {
display:none;
}
body.paid .hidefrompaid {
display:none;
}
Or if you really want to not show it you could use jQuery to delete the text the user should not see using those same css classed wrappers around the text.
jQuery('body.registered').find('.hidefromregistered').remove();
jQuery('body.paid').find('.hidefrompaid').remove();
I ended up using the jContentHider plugin. While I still had do some work arounds, I got it working the way I want to.
For others interested:
jContentHider on GitHub

create dynamic template for joomla 1.5

there are tutorials on the web about gow to create index.html, css file and template.xml that contain placeholders. ok, i got it, it's simple. but i need a template that has some different views. for example:
-all pages have a topmenu, header, left sidebar, mainarea and a footer but:
-first page has no header .topmenu after which sidebar, mainarea and footer comes.
-second page has sidebar moved from left to right
-third page has four blocks (blocks for special offers) instead of mainarea.
as far as i can see, i need to create three standalone templates with unique set of placeholders for each template. because i can't see the way to change laarge mainarea placeholder with four placeholders for offers blocks on some pages. dynamically.
is there if-statements in joomla templates to simply determine a document id to view four placeholders instead of mainarea. or to not show header on the main page (f.e. doc. id="mainpage")
but i want it to be selectable like:
-this page has first case of that template (index_1.php)
-and that page has a second case of the same template (index_2.php)
like a selectbox.
is that possible?
I will make this an answer as opposed to a comment since I believe it will do what you are looking for.
Once your articles are setup and your links to them are established (the site has the info on it you're looking for), you can create the modules containing the data that you want shown from time to time.
Go to the module manager - on the right you should see 'module assignment' or something along the lines of 'display this module on the following pages'; you can then pick which pages you want the module to show on. You can specify all pages, none, specific pages, however you want.
This will enable you to show them only where needed however you like.
You can ALSO do this programatically inside the module (if you do custom HTML and use an extension like Sourcerer to add PHP to the module) with PHP should you want a little more flexibility, but just choosing the pages to show on should work for what you're doing.

How can I preview Virtuemart2 Order verification email layout changes?

I am trying to change the layout ( css/html structure) of Virtuemart 2 order verification emails. Problem is that I have to make a fake purchase each and every time I do a change in the 10 different files (located # components/com_virtuemart/views/invoice/order/tmpl) that create this email template.
The closest "preview" I got was this direct access url "http://domain.com/index.php?option=com_virtuemart&view=invoice&layout=invoice&format=html&tmpl=component&virtuemart_order_id=1401"
But again it loads Joomla's head/body elements not the actual email template.
So how can I have a "preview" of how the template looks like with my new changes BEFORE make an actual test purchase? Is this possible?
You shouldn't change the core files otherwise the next update of VirtueMart (of which there are many) will erase your changes.
You should use Joomla!'s template overrides which VM2 supports that way you can update as needed to new versions without loosing your changes. See this article on docs.joomla.org on "How to override the output from the Joomla! core" and this one on template overrides.
3. You need to add the &format=raw at the end of the link to retrieve just the output of the component with out the template/html body wrapped around it. Of course that relies on the component as well.
I was going to suggest using raw, but looking at the current VM2 it doesn't properly support the format=raw option. Looking at the mail layout in the invoice view it not structured to return it the way you expect, it actually generates a HTML version by default with a matching text only version.
The best I could come up given those two options
Return a close equivalent of the HTML email
http://domain.com/index.php?option=com_virtuemart&view=invoice&layout=mail&virtuemart_order_id=1401&tmpl=component
Return the text version, albeit wrapped in the html page... you may have to view the source to see your invoice text.
http://shop.craigphillips.biz/index.php?option=com_virtuemart&view=invoice&layout=mail_raw&virtuemart_order_id=4&tmpl=component

Resources