In VM2, I can use the template override default_relatedproducts.php
with the following code:
<?php echo $field->display ?>
That outputs the HTML
<a title="x" href="x">
<img alt="" src="x.jpg">
Product Name
</a>
My question is how to remove the Product Name in the above href codemi just want image
Related
I am crawling a webpage and i am using Beautifulsoup. There is a condition where i want to skip the content of one particular tag and get other tag contents. In the below code i don't want div tag contents. But i couldn't solve this. Please help me.
HTML code,
<blockquote class="messagetext">
<div style="margin: 5px; float: right;">
unwanted text .....
</div>
Text..............
<a class="externalLink" rel="nofollow" target="_blank" href="#">text </a>
<a class="externalLink" rel="nofollow" target="_blank" href="#">text</a>
<a class="externalLink" rel="nofollow" target="_blank" href="#">text</a>
,text
</blockquote>
I have tried like this,
content = soup.find('blockquote',attrs={'class':'messagetext'}).text
But it is fetching unwanted text inside div tag also.
Use the clear function like this:
soup = BeautifulSoup(html_doc)
content = soup.find('blockquote',attrs={'class':'messagetext'})
for tag in content.findChildren():
if tag.name == 'div':
tag.clear()
print content.text
This yields:
Text..............
text
text
text
,text
Ive uploaded images to a page in wordpress using the ACF Repeater plugin. The slide transition is working fine but my are not showing. Can anyone help with this ...
The custom field is called 'slides' and there are three images attached to the my home.php page.
Here is my code.
<div id="flexslider_main" class="flexslider">
<ul class="slides">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php $slides = get_field('slides');
$i = 1;
foreach ($slides as $slide){?>
<li>
<img src="<?php echo $slide['image']; ?>" class="slide_image img<?php echo slides; ?>"/>
</li>
<?php $i++;
} ?>
<?php endwhile; else: echo 'No slide images found'; ?>
<?php endif; ?>
</ul>
</div>
<!--Flex Slider-->
From what I can see, you aren't calling the sub-fields, and you removed the "rows" and changed everything to read to "slides"... this is the code I commonly use on the sliders.
<?php
$rows = get_field('slides';
if($rows) {
foreach($rows as $row)
{
?>
<li><img src="<?=$row['image']?>" alt=""></li>
<?
}
}
?>
The area that says 'image' is replaced by the sub-field name. Also make sure that you're setting your "Return Value" on the field options to Image URL.
Within Joomla 2.5.6 core login module their are three links under the login text boxes.
Forgot your password?
Forgot your username?
Don't have an account?
If a user clicks on "Create an account" it redirects then to the Joomla default registration form mysite/index.php/en/joomla/joomla-components/registration-form?view=reset
how can we change this to redirect to custom Forms page?
mysite/index.php/en/forgot-password
mysite/index.php/en/forgot-username
mysite/index.php/en/create-account
There are two ways to do it.
You can assign a menu item for each link.
Just create menus for each type like login,forgot password etc.
Or another way is to do with .htaccess.
If I am not getting you wrong than this will help you.
You can override the default layout of login module Read More
Copy modules/mod_login/tmpl/default.php and paste this to /templates/activetemplate/html/mod_login.And change the below code
<ul>
<li>
<a href="<?php echo JRoute::_('index.php?option=com_users&view=reset'); ?>">
<?php echo JText::_('MOD_LOGIN_FORGOT_YOUR_PASSWORD'); ?></a>
</li>
<li>
<a href="<?php echo JRoute::_('index.php?option=com_users&view=remind'); ?>">
<?php echo JText::_('MOD_LOGIN_FORGOT_YOUR_USERNAME'); ?></a>
</li>
<?php
$usersConfig = JComponentHelper::getParams('com_users');
if ($usersConfig->get('allowUserRegistration')) : ?>
<li>
<a href="<?php echo JRoute::_('index.php?option=com_users&view=registration'); ?>">
<?php echo JText::_('MOD_LOGIN_REGISTER'); ?></a>
</li>
<?php endif; ?>
</ul>
And set the layout in login module.
I'm trying to create a teaser node template to display all Blog teasers.
For the page tpl I have page-blogs.tpl.php
For the Blog node tpl I have node-blog.tpl.php (This one is looping to display all the blog teasers)
Now how do I create a node template to surround the node teasers?
My URL for the page with all the blog teasers is: /blogs/eric
My URL for the page with an example blog entry is: /blogs/eric/test-blog-1
I need a node template that I can use for all the Blog pages.
I tried using node-blogs-teaser.tpl.php for the individual teaser nodes and node-blog.tpl.php for the outer blog node template, but that didn't work.
Here is what I have in my node-blog.tpl.php file:
<div id="node-<?php print $node->nid; ?>" class="node<?php if ($sticky) { print ' sticky'; } ?><?php if (!$status) { print ' node-unpublished'; } ?>">
<div class="item">
<ul>
<?php print $picture ?>
<?php if ($page == 0): ?>
<?php endif; ?>
<div class="content clear-block">
<li class="title"><h4><?php print $title ?></h4></li>
<li class="photo"><img src="/<?php print $node->field_blog_image[0]['filepath']; ?>" /></li>
<li class="desc"><?php print $node->content['body']['#value']; ?></li>
<li class="link">
<?php if ($teaser): ?>
Read more | Audio/Video |
<?php endif; ?>
<?php print $submitted; ?>
</li>
<div class="clear"></div>
</div>
<div class="clear-block">
<div class="meta">
<?php if ($taxonomy): ?>
<div class="terms"><?php print $terms ?></div>
<?php endif;?>
</div>
</div>
</ul>
</div>
</div>
thanks
UPDATE: I added a page preprocessor function in template.php :
/**
* Override or insert PHPTemplate variables into the templates.
* These are the main outer templates such as page.tpl.php
*/
function phptemplate_preprocess_page(&$vars) {
// add template hints using path alias
$alias = drupal_get_path_alias($_GET['q']);
if ($alias != $_GET['q']) {
$template_filename = 'page';
foreach (explode('/', $alias) as $path_part) {
$template_filename = $template_filename . '-' . $path_part;
$vars['template_files'][] = $template_filename;
}
}
//----
}
Assuming your content type is called "blog", then node-blog.tpl.php will be used whenever a blog post needs to be displayed. The $teaser variable will be set to TRUE in node-blog.tpl.php if Drupal is wanting the teaser display, and the $page variable will be set to TRUE if the node is being shown in full page view (they will both be FALSE if the full node is being shown in a list of nodes). So you need to set up your node-blog.tpl.php to check for what type of display is being requested and return the HTML appropriate to the given type. The general setup of your node-blog.tpl.php should be along these lines:
if($teaser){
//return teaser html
}
else{
//return full node HTML
}
It's a little unclear to me from your question, but it sounds like you might have some sort of looping code in node-blog.tpl.php to iterate over the nodes on your site. You do NOT want to do this. Drupal does not work like Wordpress.
You don't mention how your list of teasers is being generated at /blogs/eric but I'd recommend using the Views module. If you use Views to generate the list of teasers then you'll be able to easily theme the list using Views' theming.
Edited since you added your example code
To stick arbitrary HTML at the top of ONLY the full node display of a blog page you could edit your node-blog.tpl.php to look something like this:
<?php if ($page): ?>
My arbitrary HTML here which will not show up in teasers and only at the top of full blog pages
<?php endif; ?>
<div id="node-<?php print $node->nid; ?>" class="node<?php if ($sticky) { print ' sticky'; } ?><?php if (!$status) { print ' node-unpublished'; } ?>">
<div class="item">
<ul>
<?php print $picture ?>
<?php if ($page == 0): ?>
<?php endif; ?>
<div class="content clear-block">
<li class="title"><h4><?php print $title ?></h4></li>
<li class="photo"><img src="/<?php print $node->field_blog_image[0]['filepath']; ?>" /></li>
<li class="desc"><?php print $node->content['body']['#value']; ?></li>
<li class="link">
<?php if ($teaser): ?>
Read more | Audio/Video |
<?php endif; ?>
<?php print $submitted; ?>
</li>
<div class="clear"></div>
</div>
<div class="clear-block">
<div class="meta">
<?php if ($taxonomy): ?>
<div class="terms"><?php print $terms ?></div>
<?php endif;?>
</div>
</div>
</ul>
</div>
</div>
Edited since finding out you're using the Blog module
To display arbitrary HTML at the top of the listing of blog teasers just stick it at the top of page-blog.tpl.php
I am using yahoo pipes to get content matching a certian category from my WordPress.com Blog. Everything is working fine but WordPress adds "share" links to the bottom of the feed that I would like to remove.
Here is what's being added:
<a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gocomments/bandonrandon.wordpress.com/87/">
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bandonrandon.wordpress.com/87/"/></a>
<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bandonrandon.wordpress.com&blog=1046814&post=87&subd=bandonrandon&ref=&feed=1" width="1" height="1"/>
I edited out some of the services but you get the idea. I tried to use regex to remove this content what I tried was this:
<a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/.*?><img alt="" border="0" src="http://feeds.wordpress.com.*?></a>
and
<img alt="" border="0" src="http://stats.wordpress.com.*?>
however it didn't fileter the results at all.
Using this would filter ALL images and works fine
<a.*?><img.*?></a>
<a[^>]+href="http://feeds.wordpress.com[^"]*"[^>]*>\s*<img[^>]+src="http://feeds.wordpress.com/[^"]*"[^>]*>\s*</a>\s*<img[^>]+src="http://stats.wordpress.com/[^"]*"[^>]*>
Regex updated, try that to match the whole lot.