show welcome message only on index.php [CI] - codeigniter

I make custom welcome message in codeigniter script, but i want show only on index.php
I have
<div class="welcome">
<?php echo getConfigSetting('config_welcome') ?>
</div>
This message show in header,on all page. I want show only on homepage (index.php)
I already tried this code but give me a blank page
<?php if( $this->uri->segment(1) == 'home' || $this->uri->segment(1) = '' ): ?>
Affordable Business Websites Done Fast…
"Just find a website you like and we will customize it to your business needs, easy as 123!"
Start Search
</div>
</div>
Any sugestion?
Thank you

you could try to use the CI helper URL and grab the first segment of the url to check whta page we are on.
example:
<?php if( $this->uri->segment(1) == 'home' || $this->uri->segment(1) = '' ): ?>
<div class="welcome">
<?php echo getConfigSetting('config_welcome') ?>
</div>
<?php endIf; ?>
of course you would want to change the "home" to the name of your homepage name you see in the url, or the default controller/method name.
You will also want to make sure you autoload the url_helper in the config/autoload.

Related

Changing error delimiter to empty in codeigniter

i want to change the form error wrapper. I don't want any wrapper no div no <p> i have used this code <?php echo form_error('inv_data_val','<div>','</div>'); ?> it do adds the div but when i used <?php echo form_error('inv_data_val','',''); ?> it still shows p
http://www.codeigniter.com/userguide3/libraries/form_validation.html#changing-the-error-delimiters
$this->form_validation->set_error_delimiters('', '');
In your controller.

I want change page heading position

In Joomla Page heading showing inside of an article I want to change the position of page heading, is it possible to customize page heading position?
I had included following code in template/protostar/index.php
<?php if ($this->params->get('show_page_heading', 1)) : ?>
<div class="page-header">
<h1> <?php echo $this->escape($this->params->get('page_heading')); ?> </h1>
</div>
<?php endif;
if (!empty($this->item->pagination) && $this->item->pagination && !$this->item->paginationposition && $this->item->paginationrelative)
{
echo $this->item->pagination;
}
?>
What you can do:
Just update one of the css files in the correct template to display the header correctly. If the header should only be reformatted on some pages and not all then you should be using different templates.
What you should do:
Otherwise (if you want to change the php instead) you can override the components/com_content/views/article/default.php using the standard joomla override method.
You can do both the above if necessary.
You should not need to override the index.php of your template in order to do this. However if you really want to i would use the code
$option = JRequest::getCmd('option');
$view = JRequest::getCmd('view');
if ($option=="com_content" && $view=="article") {
$ids = explode(':',JRequest::getString('id'));
$article_id = $ids[0];
$article =& JTable::getInstance("content");
$article->load($article_id);
echo $article->get("title");
}
Sorry if you want more you need to give more :)
PS. I am on joomla 2.5 but i know that for joomla 3 it is more or less the same thing.
Sources: http://forum.joomla.org/viewtopic.php?t=525350
http://docs.joomla.org/How_to_override_the_output_from_the_Joomla!_core

open a modal windows in a server

Hi everyone I have a modal windows in joomla 3.0!
I pass the router to javascript like this
<?php $link =JURI::root().'index.php?option=com_projects&view=proyectos&format=raw&task=todosProyecto&id='. $item->id;?>
<li class="item" data-id="id-<?php echo $item->id ?>" data-type="<?php echo $item->categoria ?>">
<a href="#modal" id="<?php echo $link;?>" role="<?php echo $item->id ?>" class="picture" data-toggle="modal">
<img src="<?php echo JURI::root()?><?php echo $item->imagen_portada; ?>"/></a>
<p class="titulo"><?php echo $item->nombre; ?></p>
<p> <?php echo $item->municipio; ?>(<?php echo $item->pais; ?>)<br><?php echo $item->year; ?>
</p>
In local when I open the modal windows it work well, but in the server the modal windows show me the index.php view of this component.
I think that my problem is here, when I take the request for the model I have this.
public function elegirSeleccionados(){
$this->pagination = $this->get('pagination');
$this->items = $this->get('recientes');
$this->list = $this->get('list');
parent::display();
}
But $this->get('list'); is null so I have to asigned a null value to list.
I changed by that..
$this->list = $this->items;
but dont work to!
Any idea!!!
Where is this code?
First part looks like a Layout (views\proyectos\tmpl\default.php) and the second one like a View (views\proyectos\view.html.php).
If it is so, I'd say you are not really loading items in View from the Model. Try using $this->items = $this->get('Items');
But this doesn't explain different results on server and local host.
Hi everyone I solved the problem... the name of my view hava a Camelcase for example itemId and joomla try to find itemid, so don´t find the view and show the default view in the modal.
So I change the name of file without camelCase and now work.!

Add magento CMS pages to navigation bar

I am new to Magento and completely lost. I have a problem in assigning CMS pages to navigation bar.
Say from manage categories I am creating a sub category contact us & want to show a cms page named contact us in the frontend when clicking on that contact us menu. What do I have to do for that? And after clicking on the menu it should go to a page like mysite.com/contact-us.html. It is going there but it's showing there are no products matching the selection.
You can use this code to get all cms pages dynamically in navigation
Place this code in header file below topcontainer
<?php $collection = Mage::getModel('cms/page')->getCollection()->addStoreFilter(Mage::app()->getStore()->getId());?>
<?php $collection->getSelect()
->where('is_active = 1'); ?>
<ul id="nav">
<?php foreach ($collection as $page): ?>
<?php $PageData = $page->getData(); ?>
<?php// print_r($PageData);?>
<?php if($PageData['identifier']!='no-route' && $PageData['identifier']!='enable-cookies' && $PageData['identifier']!='home2') { ?>
<li>
<span><?php echo $PageData['title'] ?></span>
</li>
<?php } ?>
<?php endforeach; ?>
</ul>
Note change this part of code "/magento/index.php/" according to your domain
Create a category
Create your cms page
Create an URL rewrite that redirects your category to your cms page.
Thus, you will have a link in the menu and that link would redirect
to your CMS page.
Example:
Category:
Name: About Us
URL Key: about-us
ID: 4
CMS page:
Name: About Us
URL Key: about-us
URL Rewrite:
Type: Custom
ID Path: about-us
Request path: catalog/category/view/id/4
Target path: about-us/
Redirect: Permanent

Show Product on Search Page - Magento 1.7

Currently I have a snippet of code that will forward a user to the product page if they search for a term and only 1 product is associated with that keyword.
<?php if($this->getResultCount() == 1): ?>
<?php $prodId = $this->_productCollection->getAllIds() ?>
<?php $singleProduct = Mage::getModel('catalog/product')->load($prodId) ?>
<?php header('Location: ' . $singleProduct->getProductUrl()) ?>
<?php exit; ?>
<?php elseif($this->getResultCount()): ?>
However, what I want to do now is actually serve up the product and all its details on the results page itself if its the only one with that tag/search term INSTEAD of redirecting to the product page. Im pretty new to php so please bear with me.
Block template is bad place for this. Good place - controller.
Maybe you need rewrite controller for this functionality.
For example/app/code/core/Mage/CatalogSearch/controllers/ResultController.php
In controller your code looks like:
$this->getResponse()->setRedirect($_product->getProductUrl());

Resources