Codeigniter link issue - codeigniter

Hello all first sorry for the stupid question.
I am making a small job board with codeigniter, and i ran into a problem.
On the main page it lists the jobs and when i click on them it redirect to the details page with the infos about the job.
My problem is i made a category filter where they can browse the jobs by clicking on a category, and on that page when i click the link for the details its giving me this url: localhost/jobboard/lists/category/lists/details/test-job insted of this localhost/jobboard/lists/details/test-job <-- this is the right one.
<li>
<a href="<?php base_url(); ?>lists/details/<?php echo $res->job_link ?>">
<span><?php echo $res->job_title ?></span>
<p><?php echo $job_type ?> | <?php echo $res->job_location ?> | <?php echo $res->company_name ?></p>
</a>
</li>
and the above code should not show this: *localhost/jobboard/lists/category/lists/details/test-job
Could please soeone give me a hint? because i tried a few things and im totally clueles
Thank you

Darn i got it, i forgot to echo the base url....

Related

Display comment regarding posts

I am developing a blog using codeigniter, every thing works good like posts are being stored comments are being made likes also works the only problem is fetching the comments using codeigniter against each post. What i want to do is that i want to send id to controller of each id when page loads. Here is the screenshot to make it more clear how i am working.
Front end is like this
Now the code section:
1. Code on the blog page where all messages and posts are being shown
<div class="col-lg-11 col-md-10 col-sm-10 col-xs-9 post_message" id="getComments<?php echo $blog -> blog_id; ?>">
<p>
<?php echo $blog -> message; ?>
</p>
<span class="pull-left">
<small> Posted By: <?php echo $blog -> name; ?></small>
</span>
<!-- onclick="get_comments(this.id, '<?php //echo base_url('users/get_comments_total'); ?>')" id="<?php// echo $blog -> blog_id; ?>-->
<a>
<i class='fa fa-comment' aria-hidden='true'></i> Comments (<small> <?php echo $rows; ?> </small>)
</a>
<a onclick="update_like('<?php echo $blog -> blog_id; ?>', '<?php echo base_url('users/update_like'); ?>')">
<i class='fa fa-thumbs-up' aria-hidden='true'></i> Likes (<small><?php echo $blog -> likes; ?></small>)
</a>
<div class="result_id<?php echo $blog -> blog_id; ?>" style="display: block;float: left;width: 100%;"></div>
</div> <!-- End of post message -->
In the above code there is a line written in comments where on-click function is defined i want to pass each id on page load to controller instead of click and all this code is written in foreach loop.
Help me with this thing or tell if there is any better idea to achieve this. Please do see the image attached with this so that you can know easily how i want to display the comments. one hint is like FB comments.
What is $rows?
If the likes are working OK then you can use the same idea for the comments. Probably you have joined the likes table and that is why you have $blog -> likes;. You should join the comments table to the query and then use Comments (<small> <?php echo $blog->comments; ?> </small>).
If this does not work you should provide your query in the model and your database structure.

Linking intro image in Joomla 3.3.1

I would like to turn all intro images on the blog layout to links to the articles just as read more does.
Found this post here:
Joomla 3.1 intro image as read more link
The solution here is to replace the code in default_item.php from this:
<img
<?php if ($images->image_intro_caption):
echo 'class="caption"'.' title="' .htmlspecialchars($images->image_intro_caption) .'"';
endif; ?>
src="<?php echo htmlspecialchars($images->image_intro); ?>" alt="<?php echo htmlspecialchars($images->image_intro_alt); ?>"/>
To this:
<a href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid)); ?>"><img
<?php if ($images->image_intro_caption):
echo 'class="caption"'.' title="' .htmlspecialchars($images->image_intro_caption) .'"';
endif; ?>
src="<?php echo htmlspecialchars($images->image_intro); ?>" alt="<?php echo htmlspecialchars($images->image_intro_alt); ?>"/> </a>
Followed the instructions, added an override folder in my template, copied default_item.php to it and made the change to the code. Nothing happened. I then tried to change the same lines in the component folder just to see if the problem was with the template override, nothing.
Is there another way of doing this?
Thanks in advance,
Guy.
default_item.php is only used as part of the featured articles view. If you are using the blog view, then the files appear under com_content/views/category/
The image itself is generated under com_content/views/category/blog_item.php on line 35
<?php echo JLayoutHelper::render('joomla.content.intro_image', $this->item); ?>
Change this to (via your template override)
<a href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid)); ?>">
<?php echo JLayoutHelper::render('joomla.content.intro_image', $this->item); ?>
</a>

Add Homepage link to Magento menu bar

I am trying to add a homepage link to the main menu of Magento. I have modified top.phtml in my template/catalog/navigation and added the line
<li>
<?php echo $this->__('Home'); ?>
</li>
between the <ul>'s but it doesn't work?
Try
<li>
<?php echo $this->__('Home'); ?>
</li>
Then flush cache if any
Try using this. It will return the base url of your site.
<?php echo Mage::getBaseUrl(); ?>

Product category name on product viewing page

I'm working on a website. Upon clicking the product it shows all the details of it. But my client want me to show parent category of categroy of the product at top, above the image. Please help me about it. I'm a budding developer.
Try this may be help someone else.
<?php $_helper = $this->helper('catalog/output');?>
<?php $_category_detail=Mage::registry('current_category');?>
<?php $_category_detail->getName();?>
<?php $_category_detail->getId(); ?>
You can get the category data from your product object: $_product->getCategory()->getName();. You will have to edit the template at template/catalog/product/view.phtml. In the template file look for <div class="product-img-box"> and add:
<div class="product-img-box">
<h4><?php echo $_product->getCategory()->getName(); ?></h4>
<?php echo $this->getChildHtml('media') ?>
</div>

Category url goes to 404 page in magento

I'm new to magento when i list categories in sidebar. when i click the category name means it will go to 404 error page. If you have any idea Please tell me as soon as possible..
and my code is
<?php
$_categories = Mage::getModel('catalog/category')->load(3)->getChildrenCategories();
if($_categories->count()):
$categorycount = 0;
foreach ($_categories as $_category):
if($_category->getIsActive()):
$cur_category=Mage::getModel('catalog/category')->load($_category->getId());
$layer = Mage::getSingleton('catalog/layer');
$layer->setCurrentCategory($cur_category);
?>
<li><a href="<?php echo $_category->getURL() ?>" title="<?php echo
$this->htmlEscape($_category->getName()) ?>"><span class="categoriesHead"><?php
echo $this->htmlEscape($_category->getName()) ?></span>
</a>
</li>
<?php
endif;
endforeach;
endif;
?>
I had the same issue in 1.5.1 and in my case it was the category url suffix which was expecting a .html suffix but the links were giving me blank. I changed Admin>>System>>Configuration>>Catalog>>Search Engine Optimisations>>category suffix from ".html" to "" (blank) and it's working fine now.
I spend so much time on this problem.... You might have made your categories root categories and not subcategories. Simply drag and drop them into the default category and see if that gives you a better url.
You can see if you are getting a bad url by just appending index.php/name of category in small case/ to the base url
Try this:
Go in admin>>System>>Configuration>>Catalog and under Category permissions select No at Enable option.
Then click Save config and clear Magento cache.

Resources