The Flat template is—in my opinion—a simple and elegant WordPress template.

Still, when printing blog pages, the output contains a large amount of whitespace.

CSS Customization

Using the template customization feature of WordPress, I adjusted the CSS of the Flat template to suit my needs.

The following CSS fragment is a suggestion for producing a more concise print rendering using the Flat WordPress theme.

@media print {
  .site-info, .entry-meta, .nav-links, .tags-links, a::after, #bit, .fa {
    display: none;
  }
  #masthead .site-title, .hentry .entry-title {
    font-size: 30px;
    font-family: Handlee;
  }
  #masthead .site-title {
    padding-bottom: 0px;
  }
  .post {
    padding-top: 0px;
  }
  .hentry .entry-content {
    padding-top: 0px;
  }
  h2 {
    font-size: 24px;
    margin-top: 5px;
  }
  table.easy-table {
    max-width: 90%;
  }
  .easy-table th, .easy-table td {
    padding-top: 1px;
    padding-bottom: 1px;
  }
}

Testing

I tested the print template live inside Firefox using the Developer Toolbar (Tools → Web Developer → Developer Toolbar) and the command media emulate print.

Chromium also offers a similar functionality in the Developer Tools (Ctrl+Shift+I) → Menu → More tools → Rendering → Emulate CSS media.

To assign default permissions to pages in Typo3, the following TSConfig snippet is helpful:

TCEMAIN{
  permissions.userid = 1 # Backend user with ID 1
  permissions.groupid = 1 # Backend user group with ID 1
  
  permissions.user = show, editcontent, edit, new, delete
  permissions.group = show, editcontent, edit, new, delete
  # no permissions for 'other'
}

This code should be placed at Edit Page > Resources > TypoScript Configuration.

After saving the configuration, any new page below the edited page receives the configured default permissions.

Dieser Artikel beschreibt, wie Styles in der ECommerce-Software Gambio2 auch ohne EyeCandy verwendet werden können. Leider war es mir nicht möglich, beim Umzug von Gambio nach Gambio GX2 die Styles einfach zu übernehmen. Daher wechselte ich das Template von EyeCandy zu gambio und führte die unten beschriebenen Änderungen durch.

Die ursprüngliche Datei, die sich zunächst ergeben hat, war ca. 208 KByte groß und enthielt viele Redundanzen (z.B. gleichen Definitionen in unterschiedlichen Hierarchiestufen). Ich habe die Datei auf eine Größe von ca. 110 KByte gebracht, ohne dass die Funktionalität gelitten hat.

Das Ergebnis ist im ConeleK-Shop zu betrachten.

Statisches .css File einlesen

Zunächst muss eine kleine Änderung in der Datei includes/header.php durchgeführt werden, damit die Gambio-Shop-SW die statische .css Datei einliest.

original

<link type="text/css" rel="stylesheet" href="<?php // echo 'templates/'.CURRENT_TEMPLATE.'/gm_dynamic.css.php'.$renew_cache; ?>" />

ersetzt durch:

<link type="text/css" rel="stylesheet" href="<?php echo 'templates/'.CURRENT_TEMPLATE.'/stylesheet.css';&nbsp; ?>" />

Nun wird nicht mehr die Programmdatei gm_dynamic.css.php sondern die Datei /templates/gambio/stylesheet.css aufgerufen.

Eine kleine Version dieser Datei ist schon im System vorhanden, diese reicht jedoch nicht aus, um ein vernünftiges Design zu erstellen.

.css File erstellen

Nun wird ein statisches .css File erstellt. Dieses Stylesheet setzt sich aus dem ursprünglichen Datei templates/gambio/stylesheet.css
und einer selbst erstellten .css Datei zusammen. Diese neue Datei wird an Stelle der ursprünglichen stylesheet.css Datei verwendet. Wir haben hierzu unser altes Stylesheet aus der der alten Gambio Installation benutzt. Diese Datei befindet sich unter:

/cache/__dynamics.css

Sie ist leider für den Menschen nicht gut lesbar, da sie nicht formatiert ist. Wir haben sie mit einem Texteditor (Kate / Kubuntu Linux) und regulären Ausdrücken so bearbeitet, dass sie ein lesbares Format hat. In diese Datei haben wir die Datei templates/gambio/stylesheet.css integriert.

Nun haben wir ein funktionierendes Stylesheet für unseren GX2-Shop, das im wesentlichen auf Styles des alten GX-Shops beruht.

Styles bearbeiten

Wie findet man nun die Bezeichungen der Klassen (class) und IDs (id). Hier hilft ein Addon für den Firefox, der Firebug. Wenn dieser in Firefox installiert ist, kann man jedes Element einer Internet-Seite inzpizieren, Indem man man mit der Maus über das Element fährt und die rechte Maustaste klickt, Im Kontext-Menü, welches dann erscheint, wählt man dann “Inspect Element” und erhält so den Namen der Klasse oder ID. In der Datei lokalen stylesheet.css kann man nun mit Hilfe der Suchfunktion die entsprechende Klasse bzw. ID suchen und die Eigenschaften bearbeiten. Die Datei kann dann nach der Bearbeitung mit Hilfe eines ftp-Programms hoch geladen werden. Wir verwenden hierzu Filezilla stylesheet.css vom Server auf den lokalen Computer heruntergeladen und öffnet sie mit Filezilla mit dem Menüpunkt Maus -> rechts -> edit mit seinem Texteditor, so erscheint bei jeder Änderung / Abspeichern ein Dialog, der fragt, ob man die geänderte Datei hoch laden möchte. Klickt man auf “Yes” geschieht dies an die richtige Stelle.

Man kann nun das Ergebnis der Änderung mit dem Browser anschauen. Nicht vergessen beim Firefox Strg + R zu drücken, um den Cache zu leeren und die Seite neu aufzurufen.

Noch schneller geht es übrigens mit Webdav (Web-based Distributed Authoring and Versioning). Viele lokale Filesystem-Browser beherrschen Webdav. Hat man ein Webdav zu deinem Server und dem Ordner in dem sich das Shopsystem befindet eingerichtet, erscheint dessen Dateisystem im lokalen Filesystem-Browser wie auf dem eigenen Computer. Man kann nun mit einer entfernten Datei, wie z.B. der stylesheet.css arbeiten, wie mit einer Datei auf dem lokalen Computer. Nach Editieren der Datei klickt man auf “Speichern” und die Datei wird direkt auf dem Server geändert und gespeichert.

Download

Unter folgendem Link können Sie das Stylesheet herunterladen. Wir bitten Sie allerdings für Ihren eigenen Style anzupassen und nicht das ConeleK Design zu verwenden. Benennen Sie die Datei in stylesheet.css um: stylesheet_gambio_template_120903.css.zip

Siehe auch

Gambio GX2: Boxen ohne Styleedit platzieren

Dieser Artikel beschreibt, wie die Boxen in Gambio GX2 ohne Styledit platziert werden können.
Leider war es mir nicht möglich, die Platzierung der Boxen einfach aus Gambio in Gambio GX2 zu übernehmen.

Der Vorteil des Templatese gambio und gegenüber des neuen Templates EyeCandy ist, dass Boxen auf beiden Seiten platziert werden können: Links, wo der potentielle Kunde zuerst hin schaut, sollen nur wirklich relevante Informationen stehen. Diese sind das Feld für die Schnellsuche, der Produktkatalog und Links zu diesem Wiki (in dem sich die technischen Informationen für unsere CEK Module befinden) und die Sitemap. Rechts erscheinen Informationen, die nur für Besucher, die in Erwägung ziehen etwas zu kaufen, oder mehr allgemeine Informationen benötigen. Nur das Template gambio bietet die Möglichkeiten von beidseitigen Boxen.

Das Ergebnis kann man sich im Shop von ConeleK ansehen.

Platzierung der Boxen

Die Reihenfolge der Boxen kann in der Datei

/templates/gambio/template_settings.php

verändert werden. Die Information über die Positionierung und den Status der jeweiligen Box finden wir im Array $t_menubox_array .

Im Folgenden ist das Array so wiedergegeben, wie es für unseren Shop definiert wurde:

$t_menubox_array = array(
	'add_quickie' => array('POSITION' => 'gm_box_pos_4', 'STATUS' => 0),
	'admin' => array('POSITION' => 'gm_box_pos_101', 'STATUS' => 1),	// Admin Info
	'bestsellers' => array('POSITION' => 'gm_box_pos_112', 'STATUS' => 0),
	'cart' => array('POSITION' => 'gm_box_pos_107', 'STATUS' => 1),
	'categories' => array('POSITION' => 'gm_box_pos_2', 'STATUS' => 1),	// Kategorien
	'content' => array('POSITION' => 'gm_box_pos_104', 'STATUS' => 1),	// Mehr über ConeleK
	'currencies' => array('POSITION' => 'gm_box_pos_12', 'STATUS' => 0),
	'extrabox1' => array('POSITION' => 'gm_box_pos_22', 'STATUS' => 0),
	'extrabox2' => array('POSITION' => 'gm_box_pos_123', 'STATUS' => 0), 
	'extrabox3' => array('POSITION' => 'gm_box_pos_127', 'STATUS' => 0),
	'extrabox4' => array('POSITION' => 'gm_box_pos_128', 'STATUS' => 0),
	'extrabox5' => array('POSITION' => 'gm_box_pos_131', 'STATUS' => 0),
	'extrabox6' => array('POSITION' => 'gm_box_pos_133', 'STATUS' => 0),
	'extrabox7' => array('POSITION' => 'gm_box_pos_135', 'STATUS' => 0),
	'extrabox8' => array('POSITION' => 'gm_box_pos_137', 'STATUS' => 0),
	'extrabox9' => array('POSITION' => 'gm_box_pos_139', 'STATUS' => 0),
	'gm_bookmarks' => array('POSITION' => 'gm_box_pos_24', 'STATUS' => 0),
	'gm_counter' => array('POSITION' => 'gm_box_pos_20', 'STATUS' => 0),
	'gm_ebay' => array('POSITION' => 'gm_box_pos_8', 'STATUS' => 0),
	'gm_scroller' => array('POSITION' => 'gm_box_pos_31', 'STATUS' => 1),	// Neuigkeiten (Scrollbox)
	'gm_trusted_shops_widget' => array('POSITION' => 'gm_box_pos_142', 'STATUS' => 0),
	'infobox' => array('POSITION' => 'gm_box_pos_103', 'STATUS' => 1),	// Kundengruppe
	'information' => array('POSITION' => 'gm_box_pos_1', 'STATUS' => 1),	// Informationen
	'languages' => array('POSITION' => 'gm_box_pos_10', 'STATUS' => 0),
	'last_viewed' => array('POSITION' => 'gm_box_pos_26', 'STATUS' => 1),
	'login' => array('POSITION' => 'gm_box_pos_102', 'STATUS' => 1),	// Kundenlogin
	'manufacturers' => array('POSITION' => 'gm_box_pos_116', 'STATUS' => 0),
	'manufacturers_info' => array('POSITION' => 'gm_box_pos_125', 'STATUS' => 0),
	'newsletter' => array('POSITION' => 'gm_box_pos_18', 'STATUS' => 0),
	'order_history' => array('POSITION' => 'gm_box_pos_108', 'STATUS' => 0),
	'paypal' => array('POSITION' => 'gm_box_pos_140', 'STATUS' => 0),
	'reviews' => array('POSITION' => 'gm_box_pos_16', 'STATUS' => 0),
	'search' => array('POSITION' => 'gm_box_pos_2', 'STATUS' => 0),
	'specials' => array('POSITION' => 'gm_box_pos_105', 'STATUS' => 1),	// Angebote
	'trusted' => array('POSITION' => 'gm_box_pos_118', 'STATUS' => 0),
	'whatsnew' => array('POSITION' => 'gm_box_pos_106', 'STATUS' => 1),	// neue Artikel
        'yoochoose_also_clicked' => array('POSITION' => 'gm_box_pos_46', 'STATUS' => 0),
        'yoochoose_top_selling' => array('POSITION' => 'gm_box_pos_48', 'STATUS' => 0),
	'ekomi' => array('POSITION' => 'gm_box_pos_144', 'STATUS' => 0)
);

Die Kommentare (//) geben den Titel an, unter welchem der Inhalt in der Seite erscheint.

Die Position der jeweiligen Box wird jeweils durch die Konstante ‘POSITION’ definiert.

Der Status der Box, also ob sie sichtbar oder unsichtbar ist, wird durch die Konstante ‘Status’ festgelegt.

Beispiel:

'categories' => array('POSITION' => 'gm_box_pos_2', 'STATUS' => 1), // Kategorien

In diesem Beispiel handelt es sich um die Box Kategorien. Sie ist eingeschaltet

'STATUS' => 1

und befindet sich auf der linken Seite des Shops an Position 2.

'POSITION' => 'gm_box_pos_2'

Die Boxen für die rechte Seite haben für die Werte ≥ 100.

Die Box Kundenlogin

'login' => array('POSITION' => 'gm_box_pos_102', 'STATUS' => 1),	// Kundenlogin

befindet sich auf der rechten Seite des Shops in der ersten Position 2, da

'POSITION' => 'gm_box_pos_102'

und ist eingeschaltet, da

'STATUS' => 1

Siehe auch

The e-shop software Gambio 2 may display so-called special offers (that is price-reduced articles or such) on its startpage. Whether specials are displayed or not is configured with the option GM_SPECIALS_STARTPAGE (ID=1111):

  • If its value is an integer and greater 0, special offers are displayed.
  • Otherwise, special offers are hidden.

To display special offers. open the Gambio database and run the following SQL query:

UPDATE `gm_configuration` SET `gm_value` = '1' WHERE `gm_configuration`.`gm_configuration_id` = 1111

To hide special offers, run the following SQL query:

UPDATE `gm_configuration` SET `gm_value` = '-1' WHERE `gm_configuration`.`gm_configuration_id` = 1111

Details (optional)

The following information are technical details, which may change as time passes.

The rendering of the “specials box” is done in the following PHP file: includes/modules/specials_main.php .

The embedding in the center of the page happens in the following PHP file: includes/center_modules.php .

For security reasons, WordPress does not allow to upload XML files into the media library, by default. To alleviate this limitation, you have to add the following PHP code to functions.php in your current theme.

add_filter('upload_mimes', 'custom_upload_xml');
 
function custom_upload_xml($mimes) {
    $mimes = array_merge($mimes, array('xml' => 'application/xml'));
    return $mimes;
}

In my setup, the path to this file is [WORDPRESS_ROOT]/wp-content/themes/[MY_THEME]/functions.php.

Thanks to Ernie Leseberg for writing about this solution.

TIOBE Index (link)

Monthly index and statistics dating back to 1989. Results from the top 25 search engines (according to Alexa.com) are used to calculate the language popularity (see TIOBE definition).

langpop.com (link)

This site offers two rankings: one search engine-based (How many resources exist in that language?) and one community-based (How many people talk about a language?).

The search engine-based results are composed from GitHub, Googe File Search, Ohloh, Craigslist, and Google Search.

The community-based results stem from Reddit, Slashdot, and Lambda The Ultimate.

PYPL PopularitY of Programming Languages (link)

Programming language top 10 based on Google Trends.

langpop.corger.nl (link)

Nice graphical comparison based on questions posted on Stackoverflow and pushes on GitHub.

It happened to me that my Wicket web application does not reliably reload static resources such as CSS stylesheets or JavaScript code. The problem need not be Wicket in this respect, but may also result from the browser’s caching policy. Wicket can circumvent this problem by updating the lastModified property of static resources.

Wicket 1.5 and above

Wicket 1.5 has introduced an advanced caching configuration, that allows you to even implement your own caching strategies (see here). Basically, you now have to create an instance of IResourceCachingStrategy that uses a particular IResourceVersion. The IResourceCachingStrategy determines how the filename is modified and the IResourceVersion determines how the current version information is calculated (e.g. last modified, checksum,…). A minimal working example looks like this:

import org.apache.wicket.request.resource.caching.FilenameWithVersionResourceCachingStrategy;
import org.apache.wicket.request.resource.caching.version.LastModifiedResourceVersion;

public class MyApplication extends WebApplication {
    @Override
    protected void init() {
        IResourceCachingStrategy strategy = new FilenameWithVersionResourceCachingStrategy(
                new LastModifiedResourceVersion());
        this.getResourceSettings().setCachingStrategy(strategy);
    }
}

The FilenameWithVersionResourceCachingStrategy is the suggested strategy. The following implementations of IResourceVersion are available:

  • LastModifiedResourceVersion uses the last modified timestamp.
  • CachingResourceVersion limits the liftetime of a cached resource to the lifetime of the object and an configured cache size.
  • MessageDigestResourceVersion calculates a hash of the cached resource. It can use various algorithms from the Java Cryptographic Architecture, by default MD5.
  • RequestCycleCachedResourceVersion caches the resources over one HTTP request lifecycle.
  • StaticResourceVersion uses a static resource version.

Before Wicket 1.5

Before Wicket 1.5, it was fairly easy: You simply needed to set a flag in the application’s settings:

public class MyApplication extends WebApplication {
    @Override
    protected void init() {
        getResourceSettings().setAddLastModifiedTimeToResourceReferenceUrl(true);
    }
}

Resources

  • [1] Solution for Wicket < 1.5
  • [2] Notes on the changes introduced in Wicket 1.5
  • [3] Javadoc of FilenameWithVersionResourceCachingStrategy

Allrounder is a very versatile template for Joomla. In its default version, the bottom corners of modules have a shadow that make the corner “lift” from the background (as if they were a piece of paper, see image).

"Lifted" corners at the bottom of a module

“Lifted” corners at the bottom of a module

I could not find a switch to disable this behavior, but the template offers to add custom CSS code. I took a look at the page’s source code and found that there are two <span> tags that build the left and right corners:

<span class="shadow-left"> </span>
<span class="shadow-right"> </span>

The shadow is actually a background image that is set via CSS:

.shadow-right {
    background-image: url("../images/shadow-r.png");
    /* ... */
}

The simplest way to fix this, is to reset the background-image to none.

Walkthrough

  1. Go to Extensions -> Template Manager and open the Allrounder style.
  2. Switch to the tab Advanced Template Options and scroll to the very bottom. (Here, you can also disable the header and footer Ribbons)
  3. Set Use Custom CSS Code to Yes
  4. Add the following CSS code in the text box:
    .shadow-right,
    .shadow-left {
        background-image: none;
    }
  5. Click  Save and Close and refresh the site.

This article describes how to modify the administrator menu in Gambio2. The admin menu builds a 2-level hierarchy:

  1. The first level is called groups and each group has an icon.
  2. The second level is called menu items. Each item has a title that appears in the menu and an associated link.

Files

The following files and directories are relevant for this tutorial:

  • system/conf/AdminMenu/
    Any XML file in this folder starting with menu_ is parsed by the shop in order to build the admin menu. This allows plugins to add menu items to existing menus. The templates are parsed with Smarty.
  • system/data/AdminPermSource.inc.php
    The class AdminPermSource checks whether a user is permitted access to a certain site. Whenever you add a link to the menu, you have to allow your admin user to see it.

The full “traceback” of the admin menu generation process looks like this:

  • admin/start.php
    This is the entry page of the administrator panel. The table cell columLeft2  contains the administrator menu. Its content is loaded by a script called colum_left.php.
  • admin/includes/column_left.php
    This script creates an instance of AdminMenuContentView that renders the administrator view.
  • system/views/AdminMenuContentView
    This class fetches the menu structure from AdminMenuControl and renders it.
  • system/controls/AdminMenuControl.inc.php
    This class is responsible of composing the menu entries with respect to the current user. It queries the AdminPermSource for user permissions and AdminFavoritesSource for the current user’s favorites
  • system/data/AdminPermSource.inc.php
    This class does the permission management for the administrator views. It queries the database table admin_access.
  • system/data/AdminMenuSource.inc.php
    This class parses the XML files in system/conf/AdminMenu and builds the menu structure regardless of user permissions.
  • system/data/AdminFavoritesSource.inc.php
    This class reads favorite menus from the database table gm_admin_favorites.

Tutorial

In this section, I provide step-by-step instructions on how to add a menu item to the Layout/Design menu that simply show the output of phpinfo.

The dummy script

First, we create a tiny script called phpinfo.php in the admin folder of the shop and add the following content:

<html>
    <body>
        <?php
        phpinfo();
        ?>
    </body>
</html>

Adding a menu item

Afterwards, we create an XML file for our custom menu entry in conf/AdminMenu/menu_roland.xml:

<?xml version="1.0"?>
<admin_menu>
    <menugroup id="BOX_HEADING_GAMBIO">
        <menuitem sort="100" link="phpinfo.php" title="PHPinfo" />
    </menugroup>
</admin_menu>

This will add a new menu item to the Layout/Design menu. Other menus can be found in the file conf/AdminMenu/gambio_menu.xml. The sort attribute defines a relative ordering, the lower the number, the earlier the item appears within a group. The link target is appended to www.your-shop.com/admin/ when the menu item is clicked and the title is the text that appears as menu item.

Permitting access

This part is a little ugly: We will hard-code the access permissions into the shop system.

The regular way of granting access to a new menu item is done in the database: The table admin_access contains one column for a user or group id and for any menu entry/view there exists a column which has a 1 in a user’s row if the user may see the column and 0 otherwise.

In our scenario we would need to add a column called phpinfo (without the .php extension).

Another option is to hardcode the permission check. For this, we open the file system/data/AdminPermSource.inc.php and modify the method is_permitted as follows:

function is_permitted($p_customers_id, $p_admin_page) {
    if ($p_admin_page === "phpinfo.php") {
        return true;
    }
    // Rest as before    
}

This hack only shows the way how you can circumvent the database-based access control –  the code may be refined, of course.

Cleaning the cache

Before seeing the results of your work, you have to visit www.your-shop.com/admin/clear_cache.php and then clear the cache (both for generated pages and for module information).

Done

When you now reload the admin panel and take a look at the Design/Layout menu, you should find a menu item called PHPinfo there.