I basically want to modify the output of my articles, by putting a between each article that is listed on my page.
I have overridden other functions in my themes template.php as follows
function mytheme_preprocess_html(&$variables) {
drupal_add_css('http://fonts.googleapis.com/css?family=Gudea', array('type' => 'external'));
}
I am looking for something similar for the articles?
Copy your theme's node.tpl.php to a file called node--article.tpl.php and add an <hr> at the bottom of the file.
Have you looked at the Views module? Take a look http://drupal.org/project/views and use it to list content for you. Views can create a Page display for this content. You can then apply styles to the Views-generated HTML that will allow you to put dividing borders between the nodes listed. Views provides 'first' and 'last' classes as well so that you will not apply a border to the last element.
Related
An archive-page gives as title: Tag: <tag-title> or Category: <category-title>. That's nice, but I like to have only: <tag-title> or <category-title>.
As far as I can see, the standard title is constructed in ../wp-includes/general-templates.php while /wp-content/languages/nl_NL.mo translates the "Tag:" and "Category:" part into Dutch.
So I tried to reach my goal by translating Tag: %s into %s; that worked, till Wordpress Translations were updated. Translating the child theme's nl_NL.mo didn't work. So I guess this is not something in the theme, but i Wordpress.
I tried to change the code in /wp-includes/general-templates.php and that worked - till WordPress was updated. So what can I do to make the changes of the title-line on my archive-pages sustainable?
You would need to create and activate a child theme, find the php template file in the parent theme which is used for archive pages and which contains the title of the archive pages, copy that file to the child theme and change that copy it to your needs.
Typically, that page would use the archive.php file or the category.php file as a template, in less complex themes it could also just use the index.php file. Depending on the complexity of the parent theme, these files could also contain include functions which use additional template-part files - you'll have to find out yourself.
When I use my CListView Widget in a page the fontsize of my whole website changes. I use flowtype to scale my fonts and keep everything responsive. Only when I use this widget everything changes, nog only the data of the widget itself.
I tried to turn the css styling of the widget of and tried to control it via an own css file, but this doesn't matter.
<?php $this->widget('zii.widgets.CListView', array(
'dataProvider'=>$dataProvider,
'itemView'=>'_view',
'cssFile'=>false,
)); ?>
The content of the view I'm calling doesn't matter either. Only when I remove the widget and put some text instead it changes back to normal.
Does someone have any idea what's happening here?
Quoted from official documentation for ClistView
cssFile property
public string $cssFile;
the URL of the CSS file used by this list view. Defaults to null,
meaning using the integrated CSS file. If this is set false, you are
responsible to explicitly include the necessary CSS file in your page.
Follow it, when you used CListView, default css .../listview/style.css file would be imported into your page, it could change your current layout if some of css is coincided with each other.
You can override it
$this->widget('zii.widgets.CListView', array(
'cssFile' => 'your-css-file-path.css',
...
)
So, eventually tried to copy the parsed code from the page source into my view. So in pagecode this was exactly the same output as the widget does in the page. Now I didn't had the resizing problem. So the widgets do something more then I can see.
For the solution I wrote an own widget to get my data in which I can control everything that happens. So no problem left anymore. Thanks for your help Telvin!
I understand and love template overwrites. I need to do some heavier changes to the menu output (basically making the output work better with Bootstrap) - but only for certain menus.
Currently in Joomla 3 there are the following in the mod_menu/tmpl folder:
default.php
default_component.php
default_heading.php
default_separator.php
default_url.php
If I want to change the classes I'd copy the default.php into my mytemplate/html/mod_menu and change it. Great, no problem.
If I want to change the link outputs to go along with that I can copy the default_component.php to mytemplate/html/mod_menu and change it. Great, no problem.
If I want to have the choice of having a different "Alternative Layout" I'd rename the mytemplate/html/mod_menu/default.php to newlayout.php, then select it in the admin module manager for that menu. Great, no problem.
Here's the problem: If I want to have the link output changed for certain menus but not all of them I figure I'd change default_component.php to newlayout_component.php like I did above which would correspond to the newlayout.php...but that doesn't work.
Questions:
1) How to have alternative layouts for each of the default_component.php, default_heading.php, default_separator.php, default_url.php template files (not just an overwrite)?
2) I would think default_url.php is the one that would affect the link outputs but it seems it's default_component.php that does. So what does each one of those do? I couldn't find any information on joomla.org about that.
Thanks!
The alternative layout feature only works for the main file (default.php), not for the sublayouts (default_component.php, ...). So you have to create your own newlayout.php which then can load newlayout_component.php, or use the default_component.php. In fact, the default_component.php will be used as fallback if no newlayout_component.php is found.
The code switches over the $item->type of the link. 'separator', 'url', 'component' and 'heading' are handled by the 'default_'.$item->type, everything else will use default_url. So a plain URL should indeed be generated by default_url.php, not default_component.php. If it behaves differently, it's likely a bug.
I'm going crazy with this one. I am trying to change a little bit the pagination style and layout in Joomla. So, I found this file: libraries\joomla\html\pagination.php but I know that pagination is overridden by this file: templates\gk_yourshop\html\pagination.php. Yet, if I modify something in gk_yourshop\html\pagination.php, I can't see the change in the pages. Does joomla cache templates and I have to re-load them (like phpBB)?. I don't understand.
I tried to check if writePagesLinks is called from joomla\html\pagination.php with this:
function getPagesLinks()
{
echo "test";
global $mainframe;
and I can't see the message. I also did this in the other pagination.php file and it's just like I can delete them and it doesn't matter. Can you help me? Thanks!
Looks like I changed it here some time ago:
\libraries\joomla\html\pagination.php
But, that is system file, so i just make a "hotfix" of it.
In Joomla 3.x you can create pagination override from Extensions > Templates > Default Template > Create Overrides > Layouts > Pagination.
The override files are created in "Default Template" "html\layouts\joomla\pagination" folder.
You can edit the override files as per your needs.
Where are you getting WritePageLinks from? That's not one of the supported methods.
http://docs.joomla.org/Understanding_Output_Overrides#Pagination_Links_Overrides
There are four functions that can be used:
pagination_list_footer
This function is responsible for showing the select list for the
number of items to display per page.
pagination_list_render
This function is responsible for showing the list of page number links
as well at the Start, End, Previous and Next links.
pagination_item_active
This function displays the links to other page numbers other than the
"current" page.
pagination_item_inactive
This function displays the current page number, usually not
hyperlinked.
[edit]
You may also want to look at Protostar as an example.
I've built a view using the views module in Drupal to display a grid of thumbnail images (field_image) that are linked to a full size image for use with Lightbox.
I've got that part working but I also display caption text beneath the thumbnail image. I want to append this caption text to the A tag like: ...
I looked at overriding the views-view-field.tpl.php template but this is no HTML in this template it just prints $output;
I'm assuming that some PHP function somewhere in the views module is generating the actual HTML code for the link but I don't know where and how to override it in my theme.
Any help would be appreciated.
The $output for views-view-field.tpl.php is generated by default in the views field handler itself. You can set aside the $output variable, and use the template variables mentioned in the comments at the start of the file to build your own output.
I install the devel module, then using dpm($row) (etc) to see what values are available. All fields your View is pulling are available in the template. This includes fields for which you check on the "Exclude" option.
In building your link, I suggest you use the Drupal API functions, that way the link will be properly modified by other Drupal functions.
l(t('Link Title'), url/path, array(
'attributes' => array(
'title' => t('My Image Caption'),
),
));