jdoc style values for Joomla 2.5 template - html

I'm creating an HTML5 template in Joomla 2.5 and I wanted to know what are my options for the style attribute in the code below?
<jdoc:include type="modules" name="top" style="???" />

Open templates\system\html\modules.php. There are defined system styles, like xhtml, rounded etc. You can also see the code how each style will be rendered.
If you want to add your own style, you need to create a new module chrome. In your template html folder (not system, don't edit above file), create file called modules.php.
Inside, make a function like this
defined('_JEXEC') or die;
function modChrome_mystyle($module, &$params, &$attribs)
{
if (!empty ($module->content)) : ?>
<div class="moduletable">
<?php if ($module->showtitle != 0) : ?>
<h3><?php echo $module->title; ?></h3>
<?php endif; ?>
<?php echo $module->content; ?>
</div>
<?php endif;
}
This way you can create custom module outputs, just edit the code the way you want.
Then, in your template file, include the module with
<jdoc:include type="modules" name="top" style="mystyle" />

Related

Wordpress Polylang adding pll_e breaks HTML

i'm using polylang to translate my blog site along with loco translate. i'm manually adding string translations which was working fine with get_theme_mod parts, but there is a place that i want to also add custom string translation, after i add manually it breaks html and css won't work then.
it should be seen like this after adding custom string translation ; works fine without pll_e
but after i add pll_e to the that part in index.html ;
<?php get_header(); ?>
<div class="content">
<?php if ( get_theme_mod('heading-enable','on') == 'on' ) : ?>
<?php echo get_template_part(pll_e ('inc/page-title') ); ?>
<?php endif; ?>
it breaks the html but translation works. its seen like this ; looks like this
does anyone knows the solution ? i think its about get_template_part and get_theme_mod because the same things that i've done with get_theme_mod parts works fine.
by the way there is difference like this with pll_e and without it.
without pll_e
with pll_e
i solved the problem by editing index.html like this ;
<div class="content">
<div class="page-title group">
<div class="page-title-inner group">
<?php if ( get_theme_mod('heading-enable','on') == 'on' ) : ?>
<h2> <?php echo get_template_part(pll_e('inc/page-title') ); ?> </h2>
<?php endif; ?>
</div><!--/.page-title-inner-->

Links configured in the template administration panel don't work on the website

The problem on a Wordpress site is that even though links are set properly in the WP admin area (see attachment 1) they do not work once the site has been published. When using inspect element it kind of shows the problem (see attachment 2).
Clicking and opening the links within the admin area is working just fine. Other links on the website work correctly. What is missing here?
Code in WP template:
<?php if ($section['link_to_doc']) : ?>
<?php foreach ($section['link_to_doc'] as $link) : ?>
<div>
<a href="<?php echo $link['link_to_doc'] ?>" class="btn-txt">
<?php echo $link['text_of_link'] ?>
</a>
</div>
<?php endforeach; ?>
<?php endif; ?>
Repeater fields:
It seems the ACF link object is not returning the right output in the href because of an error in how the links where coded.
Usually you'll want something like this:
$link = get_field('link');
<a href="<?= $link['url']) ?>"<?= $link['title'] ?></a>
That's providing the ACF field is not nested, and the field name is 'link' and there's just one.
Amended code (presumably):
<?php if ($section['link_to_doc']) : ?>
<?php foreach ($section['link_to_doc'] as $link) : ?>
<div>
<a href="<?= $link['url'] ?>" class="btn-txt">
<?= $link['text_of_link'] ?>
</a>
</div>
<?php endforeach; ?>
<?php endif; ?>
Even thought the whole concept is not the best, as you wouldn't create an extra custom field to put the text of the link since you can use $link['title'] for that but yeah...
Edit 2:
According to your screenshot edit the a to be:
<a href="<?= $link['link'] ?>" class="btn-txt">
<?= $link['text_of_link'] ?>
</a>

Wordpress: HTML sidebar at bottom, instead of right aligned with body

I added HTML to my functions.php. After the
<?PHP get_sidebar(); ?>
and before
<?php get_footer(); ?>
while the CSS is added in my style.css Child theme. The result is my box of HTML under the main content on my home page instead of being on the right side of the main content. I am hoping someone may be able to help me?
I tried to add my HTML and CSS but it wouldn't let me post it.
I've spent about 3 hours on this by myself so far. First I tried reformatting a feature provided by the Minamaze Wordpress Theme, but I figured I may as well just right my own code as it may be easier to implement.
I fixed it! Here's how: The real problem was the fact that my front page articles were individually grouped instead of wrapped in a class. I found the index.php file (the copy from my child theme) and surrounded the homepage content in a named div class. Below is code from my index file. Put a div wrapper class between get_header and the php line below it. Close the div before the get_sidebar.
get_header(); ?>
<?php while( have_posts() ): the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class('blog-article'); ?>>
<?php if ( has_post_thumbnail() ) {
$column1 = ' two_fifth';
$column2 = ' three_fifth last';
} else {
$column1 = NULL;
$column2 = NULL;
} ?>
<header class="entry-header<?php echo $column1; ?>">
<?php thinkup_input_blogimage(); ?>
</header>
<div class="entry-content<?php echo $column2; ?>">
<?php think_input_blogtitle(); ?>
<?php thinkup_input_blogmeta(); ?>
<?php thinkup_input_blogtext(); ?>
</div>
<div class="clearboth"></div>
</article><!-- #post-<?php get_the_ID(); ?> -->
<?php endwhile; ?>
<?php thinkup_input_pagination(); ?>
<?php else: ?>
<?php get_template_part( 'no-results', 'archive' ); ?>
<?php endif; ?>
?php get_sidebar(); ?>
Under get_sidebar, you can put in your HTML code for YOUR sidebar that you wish to add.
Once I wrapped them into the php into it's own class and wrapped my sidebar boxes into their own class, I used float: left and right respectively in my CSS child theme, successfully creating a sidebar. I also made their widths percentages to increase usability. You can use this same method in the content-page.php, content-single.php, if you wish to add a side bar to other pages besides just the home screen.

Magento: remove <p> tags from the header logo image - "Need file path"

What I'm attempting to do is to remove some <p> tags that wrap the header logo image which does not contain any text because I think they should not be there.
But this is throwing the following error when testing via the W3-validator.
Line 261, Column 216: Element p not allowed as child of element a in
this context. (Suppressing further errors from this subtree.)
What file should I look in to locate line 261?
I'm stuck. I've searched for hours and can't find the file-path to the file that contains the string I need to edit. I currently don't have access to link hints function so that out of the question.
Any suggestions would be highly appreciated.
Thanks a million
Fish
Update: Here is some code regarding the logo from the header.phtml
<div class="header-wrapper <?php echo $hdr_style?>">
<header>
<?php if ( $config['design']['below_logo'] ) : ?>
<div class="row clearfix">
<div class="grid_12">
<?php if ($this->getIsHomePage()):?>
<h1 class="logo"><strong><?php echo $this->getLogoAlt() ?></strong><?php echo $this->getChildHtml('theme_logo', false) ?></h1>
<?php else:?>
<strong><?php echo $this->getLogoAlt() ?></strong><?php echo $this->getChildHtml('theme_logo', false) ?>
<?php endif?>
The code comes from <?php echo $this->getChildHtml('theme_logo', false) ?>.
You need to check the layout files in the theme and see which template the 'theme_logo block' is using. That's where you can find and remove the <p> tags.

EntityMalformedException when retrieving Drupal 7 custom field

I am playing with Drupal and I am trying to add a second line to the site slogan.
The following is the piece of page.tpl.php where I am working.
<?php if ($site_name || $site_slogan): ?>
<div id="name-and-slogan" class="hgroup">
<?php if ($site_name): ?>
<h1 class="site-name">
<a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>">
<?php print $site_name; ?>
</a>
</h1>
<?php endif; ?>
<?php if ($site_slogan): ?>
<p class="site-slogan"><?php print $site_slogan; ?></p>
<?php endif; ?>
<?php
/* ADDED */
$node = menu_get_object();
$siteslogan2 = field_get_items('node', $node, 'field_siteslogan2');
?>
<?php if ($siteslogan2): ?>
<p class="site-slogan2"><?php print $siteslogan2; ?></p>
<?php endif; ?>
</div>
<?php endif; ?>
I basically added a new Content Type with a field called siteslogan2 (field_siteslogan2) and now I would like to retrieve and show it here.
The first problem is that the $node var is not defined (even if according to the documentation it should be). The second problem is that I receive EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() when I define it manually and run it.
First of all, is this the right approach to the problem? Secondly, why do I receive the EntityMalformedException and how can I fix it?
var_dump($node) produces NULL. It must be the way I get the $node content that is not good. The doc is a bit cryptic to me when it says:
$node: The node object, if there is an automatically-loaded node associated with the page, and the node ID is the second argument in the page's path (e.g. node/12345 and node/12345/revisions, but not comment/reply/12345).
This sort of thing is can be done using a preprocessing function in your theme's template.php to define and set a variable in the $varables array.
This variable then becomes available to whichever template ( page, node, form, etc ) you have done the preprocessing on. Your theme's template.php file will most likely have comments on how to do this.
for instance, doing this in the template.php creates or modifies the value of the variable $display_header, making it available for use in node.tpl.php
function yourthemename_preprocess_node(&$variables, $hook) {
$variables['display_header'] = false;
}
You can then modify the node template file to use this variable.
For something simple like a sub-slogan, you can add a setting to the theme, so it shows up on the theme's configuration page like any other theme setting.
This requires implementing this function in your theme's theme-settings.php:
function yourthemename_form_system_theme_settings_alter(&$form, $form_state) {}
This provides information to the settings form regarding the new setting. like this:
https://api.drupal.org/api/drupal/modules!system!theme.api.php/function/hook_form_system_theme_settings_alter/7
Hopefully that's enough to get you started.