How to display system message outside of template in Joomla 1.5? - joomla

Joomla Geeks!
Please help me. Web designers created design for Joomla, where
<jdoc:include type="message" />
should be located inside of custom component's view (default.php). It's because of divs nesting, I can't change anything.
Nevertheless, I have to find a solution to include Joomla system messages in component's view (default.php) instead of template's index.php, how to do that? Is it possible?
UPD: I've solved the problem, but now I need to override this code:
<dl id="system-message">
<dt class="message">MESSAGE_TYPE</dt>
<dd class="message message fade">
<ul>
<li>MESSAGE_TEXT</li>
</ul>
</dd>
</dl>
with this one:
<div class="message">
<span class="jsMessage info_message">
<span>
MESSAGE_TEXT <a class="close jsCloseMessage" href="javascript:void(0)"></a
</span>
</span>
</div>
Should I use templates/mytemplate/html/modules.php file for that?

$document = & JFactory::getDocument();
$renderer = $document->loadRenderer('message');
$msg=$renderer->render();

Related

How to change which template is extended based on user authentication

I am using Laravel 6.20.11, and I have published the Laravel blade error templates. What I need to have happen is that if the user is authenticated, the error message extends the internal-only layout, and if not, it extends the public layout like so:
#auth
#extends ('int-layouts.partials.wrapper')
#section ('error')
<div class="be-content">
<div class="main-content container-fluid">
<div class="container py-5">
<div class="row">
<div class="col-lg-8">
<div class="text-block">
<h1>404 - Not Found</h1>
<p class="text-muted text-uppercase mb-4">Sorry, we couldn't find the page you were looking for.
Please contact the administrator<br/>
Or go back to the <a class="navbar-brand py-1" href="/controlpanel/">Dashboard</a></p>
</div>
</div>
</div>
</div>
</div>
</div>
#endsection
#endauth
#guest
#extends ('ext-layouts.master')
#section('error')
<div class="container py-5">
<div class="row">
<div class="col-lg-8">
<div class="text-block">
<h1>404</h1>
<p class="text-muted text-uppercase mb-4">Sorry,You are trying to reach the page that does not exist.<br>
Please contact the administrator <br/> Or go back to the <a class="navbar-brand py-1" href="/">Home Page</a></p>
</div>
</div>
</div>
</div>
#endsection
#endguest
The problem I am having is that when I test the 404 error using abort(404) or by trying to access a route that doesn't exist, the error message displays twice and the page inherits the int-layouts.partials.wrapper even when the user isn't authenticated.
Is this expected behavior or am I doing something wrong in my blade file?
You can try to use a conditional in one #extends directive:
#extends (auth()->check() ? 'int-layouts.partials.wrapper' : 'ext-layouts.master')
Then you can use a conditional after this inside your section.
#section('error')
#auth
#else
#endif
#endsection
The #extends directive is not actually returning output directly into the compiled result like most directives do. The compiled PHP for this is held in an array to be added later.
Everything inside the ( ) of the directive is being used as a literal to call make on the View Factory:
"<?php echo \$__env->make({$expression}, \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>"
If you found the compiled view for this Blade template you would see this:
<?php echo \$__env->make(auth()->check ? 'int-layouts.partials.wrapper' : 'ext-layouts.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
The first argument to make ends up being your view name when this compiled view is executed.
In Controller function:
$layouts = Auth::user->admin ? 'view.admin' : 'view.student'; //
view.admin or view.student is the blade file which you want to render
dynamically.
return view('welcome',compact('layouts'));
Write in Blade File:
#extends($layouts)
#section('...')
...
#endsection

Vue component does not render html under hidden dropdown-menu

<div class="dropdown notification-dropdown" data-toggle="dropdown">
<img src="{{ asset('front/img/notification-bell-ico.svg') }}" alt="">
<ul class="dropdown-menu">
<div class="card notification-card">
<div class="card-header">
<p>Notification</p>
See all
</div>
<notification :user="{{ auth()->user() }}"></notification>
</div>
</ul>
</div>
I am loading my vue component as notification as seed in above code but some how it does not render html when i click header bell icon to open it
I don't know how to resolve it
if any help will be greatly appreciated.
thanks in advance.
Your snippet looks like a blade template and notification bells are often in a site's header area. It's possible your header is not within the root element you've got Vue controlling.

<img> does not show the image, even the directory is exact

I tried googling for hours, and haven't found a working solution. Why it isn't working? I tried to set the $_SERVER["DOCUMENT_ROOT"] in my php file. But still didn't work. I also tried to prepend ./ and it is still not showing the image.
I tried the {html_image} too.
index.tpl
<nav>
<div> <img src="./cat.jpg" alt="none"/> </div>
<div class="nav_buttons">Product</div>
<div class="nav_buttons">Solutions</div>
<div class="nav_buttons">Customers</div>
<div class="nav_buttons">Pricing</div>
<div class="nav_buttons">Company</div>
<div class="nav_buttons">Resources</div>
<div><span id="update">Send Me Updates</span></div>
</nav>
here my php
<?php
include('../libs/Smarty.class.php');
$smarty = new Smarty;
$smarty->display('index.tpl');
?>

Luna theme help - product images

I'm using Luna theme and would like the images on the home and product pages to be viewed as squares (to fit the theme) and then viewed as the original landscape photos when the product is clicked on. Is this possible?
Thank you!
Your question is super vague, but I assume this is your solution:
Ripping from the source after viewing the template, this is an example from the "Products" page. Here is the original code:
<li id="product_9230867" class="product">
<a href="/product/mobile-ready" title="View Mobile Ready">
<div class="product_header">
<h2>Mobile Ready</h2>
<span class="dash"></span>
<h3><span class="currency_sign">$</span>20.00</h3>
</div>
<div class="product_thumb">
<img src="http://images.cdn.bigcartel.com/bigcartel/product_images/95861562/max_w-560/MobileRun.png" class="fade_in" alt="Image of Mobile Ready">
</div>
</a>
</li>
Change the "href" of the link to an image url like this:
<li id="product_9230867" class="product">
<a href="THE_URL_TO_YOUR_IMAGE" title="View Mobile Ready">
<div class="product_header">
<h2>Mobile Ready</h2>
<span class="dash"></span>
<h3><span class="currency_sign">$</span>20.00</h3>
</div>
<div class="product_thumb">
<img src="http://images.cdn.bigcartel.com/bigcartel/product_images/95861562/max_w-560/MobileRun.png" class="fade_in" alt="Image of Mobile Ready">
</div>
</a>
</li>
Now, if you want it to pop-up really pretty, you're going to need another solution. If you want a better solution, I'd suggest asking a more clear question with examples of what you've tried already.

Calling a view inside a view

Is it possible to call a view inside a view in Laravel?
<div id="main_content">
<?php View::make('content_view'); ?>
</div>
like it nicely worked in Codeigniter
<div id="main_content">
<?php $this->load->view('content_view'); ?>
</div>
You dont 'call' a view, you 'include' the view - see template docs for more examples at Laravel.com
<div id="main_content">
#include('content_view')
</div>

Resources