phpwcms
Setup
1. Installation
Installieren wie gewohnt
2. Prepare Templates
- template/inc_layout/template.html erstellen für das Haupttemplate
- template/inc_script/frontend_init/template.php kopieren
template/inc_layout/template.html
im template block in phpWCMS referenzieren
3. phpQuery
phpquery.php enthält CP spezifische DOM Modifikationen, um z.B. ein Standardformular in Bootstrap Markup zu konvertieren.
- template/inc_script/frontend_init/phpquery.php kopieren
- template/inc_script/vendor/phpQuery-onefile.php kopieren
Haupttemplate als
4. JavaScript
Config: $phpwcms['js_in_body'] = 1;
Contentparts
CP ID | Content Part Name | Description |
---|---|---|
0 | Plain Text | |
1 | Text with image | |
2 | Images | |
3 | Link and email | |
4 | List (table) | |
5 | Link list | |
6 | HTML | |
7 | File list | |
8 | Teaser / Link article | |
9 | Multimedia | |
10 | Email form generator (old) | |
11 | Code | |
12 | Newsletter | |
13 | Search | |
14 | WYSIWYG HTML | |
15 | Article menu | |
16 | E-card | |
18 | Guestbook | |
19 | Sitemap | |
21 | External content | |
22 | RSS Feed | |
23 | Form | |
24 | Content Part Alias | |
25 | HTML5/Flash media player | |
26 | Recipe | |
27 | FAQ | |
28 | Frontend Login | |
29 | Images <div> | |
30 | Plugin/module | |
31 | Images Special | |
32 | Tabs | |
33 | News | |
50 | Rollove images | |
51 | Map | |
52 | PHP variables | |
89 | Poll | |
100 | List |
Database
MySQLi connection is slow on localhost! Put 127.0.0.1 instead of localhost into config file.
Image
Image caching
cmsimage.php
// allow caching
$lastmodified = filemtime(PHPWCMS_THUMB.$image[0]);
$filepath = PHPWCMS_THUMB.$image[0];
$gmt_mtime = gmdate('r', $lastmodified);
$etag = md5($lastmodified . $filepath);
// var_dump('soll',md5($lastmodified . $filepath), gmdate('r', $lastmodified), $_SERVER);exit;
// remove all previous headers
header_remove();
header('Accept-Ranges:bytes');
header('Cache-Control: public, must-revalidate, max-age=3600');
header('ETag: "' . $etag . '"');
header('Content-Type: ' . $image['type']);
//header('Content-Disposition: inline');
header('Content-transfer-encoding: binary');
header('Last-Modified: '.$gmt_mtime);
header('Content-Length: ' . filesize($filepath));
// http://blog.franky.ws/php-und-das-caching-via-http-header-etag/
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) || isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
if ($_SERVER['HTTP_IF_MODIFIED_SINCE'] == $gmt_mtime || str_replace('"', '', stripslashes($_SERVER['HTTP_IF_NONE_MATCH'])) == $etag) {
header('HTTP/1.1 304 Not Modified');
exit();
}
}
Custom Fields
Add custom fields for CP Tabs, Images Special and WYSIWYG
In include/config/conf.template_default.inc.php
find
<?php
$template_default['settings'] = array(
'imagespecial_custom_fields' => array(
// Enable and customise to enable additional input fields for each image special item:
'fieldgroup1' => array(
'legend' => 'Field group name',
'template' => 'default', // bind the fieldgroup to a specific template, or default
'fields' => array(
// [IMGSPCL_STRING1]{IMGSPCL_STRING1}[/IMGSPCL_STRING1]
'string1' => array(
'legend' => 'field 1',
'type' => 'str',
'render' => 'html',
'maxlength' => 100,
'placeholder' => ''
),
// [IMGSPCL_TEXTAREA1]{IMGSPCL_TEXTAREA1}[/IMGSPCL_TEXTAREA1]
'textarea1' => array(
'legend' => 'field 2',
'type' => 'textarea',
'render' => '',
'rows' => 3,
'placeholder' => ''
),
// [IMGSPCL_OPTIONNAME1]
// Will be the selected value {IMGSPCL_OPTIONNAME1}
// [IMGSPCL_OPTIONNAME1_OPTION1]{IMGSPCL_OPTIONNAME1_OPTION1}[/IMGSPCL_OPTIONNAME1_OPTION1]
// [IMGSPCL_OPTIONNAME1_OPTION2]{IMGSPCL_OPTIONNAME1_OPTION2}[/IMGSPCL_OPTIONNAME1_OPTION2]
// [/IMGSPCL_OPTIONNAME1]
'optionname1' => array(
'legend' => 'choose',
'type' => 'option',
'render' => '',
'values' => array(
'option1' => 'value option 1',
'option2' => 'value option 2',
'empty' => 'nothing',
),
'default' => 'empty'
),
// [IMGSPCL_INTEGER1]{IMGSPCL_INTEGER1}[/IMGSPCL_INTEGER1]
'integer1' => array(
'legend' => 'integer 1',
'type' => 'int',
'render' => '',
'max' => 1000,
'min' => -1000,
'step' => 1,
'placeholder' => ''
),
// [IMGSPCL_FLOAT1]{IMGSPCL_FLOAT1}[/IMGSPCL_FLOAT1]
'float1' => array(
'legend' => 'float 1',
'type' => 'float',
'render' => '',
'max' => 1000,
'min' => -1000,
'step' => .1,
'placeholder' => ''
),
// [IMGSPCL_SELECT1]
// Will be the selected value {IMGSPCL_SELECT1}
// [IMGSPCL_SELECT1_OPTION1]{IMGSPCL_SELECT1_OPTION1}[/IMGSPCL_SELECT1_OPTION1]
// [IMGSPCL_SELECT1_OPTION2]{IMGSPCL_SELECT1_OPTION2}[/IMGSPCL_SELECT1_OPTION2]
// [/IMGSPCL_SELECT1]
'select1' => array(
'legend' => 'choose',
'type' => 'select',
'render' => '',
'values' => array(
'empty' => 'choose a value or this for nothing',
'option1' => 'value option 1',
'option2' => 'value option 2',
),
'default' => 'empty'
),
// [IMGSPCL_BOOL1]True[/IMGSPCL_BOOL1][IMGSPCL_BOOL1_ELSE]False[/IMGSPCL_BOOL1_ELSE]
'bool1' => array(
'legend' => 'Enable (to be true)',
'type' => 'bool',
'default' => false, // or true to be enabled by default
),
'file1' => array(
'legend' => 'file 1',
'type' => 'file',
'template' => '', // if empty the default file list template is used
'filetypes' => 'pdf,txt', // comma separated allowed filetypes 'xls,docx,vcf'
'direct' => 0 // direct file download 1 or not 0
)
)
),
'geo' => array(
'legend' => 'Google Maps',
'template' => 'geo.html', // bind the fieldgroup to a specific template, or default
'fields' => array(
// [TAB_GEOLOCATION]{TAB_GEOLOCATION}[/TAB_GEOLOCATION]
'geolocation' => array(
'legend' => 'Geo-Location/Adresse',
'type' => 'str',
'render' => 'html',
'maxlength' => 250,
'placeholder' => 'Strasse, PLZ Ort, Land'
),
// [TAB_LAT]{TAB_LAT}[/TAB_LAT]
'lat' => array(
'legend' => 'Latitude',
'type' => 'float',
'render' => '',
'max' => 90,
'min' => -90,
'step' => .0000001
),
// [TAB_LON]{TAB_LON}[/TAB_LON]
'lon' => array(
'legend' => 'Longitude',
'type' => 'float',
'render' => '',
'max' => 180,
'min' => -180,
'step' => .0000001
),
// [TAB_MARKERICON]
// Will be the selected value {TAB_MARKERICON}
// [TAB_MARKERICON_MARKERICON1]{TAB_MARKERICON_MARKERICON1}[/TAB_MARKERICON_MARKERICON1]
// [TAB_MARKERICON_MARKERICON2]{TAB_MARKERICON_MARKERICON2}[/TAB_MARKERICON_MARKERICON2]
// [/TAB_MARKERICON]
'markericon' => array(
'legend' => 'Markierung',
'type' => 'select',
'render' => '',
'values' => array(
'empty' => 'Google Standard (red Drop)',
'marker_01' => 'Black Marker, white filled',
'marker_02' => 'Black Marker, transparent',
'marker_03' => 'Blue Marker, white filled',
'marker_04' => 'Blue Marker, transparent',
),
'default' => 'empty'
),
// [TAB_INFOBOX]True[/TAB_INFOBOX][TAB_INFOBOX_ELSE]False[/TAB_INFOBOX_ELSE]
'infobox' => array(
'legend' => 'Infobox aktiv',
'type' => 'bool',
'default' => true, // or true to be enabled by default
),
)
),
),
);
and copy this to template/inc_settings/template_default/custom_settings.php
.
Set this custom settings file in Site Structure ➡ Setting to overwrite the standard templates.
In contentpart Images (Special) select the template that is set in
$template_default['settings']['imagespecial_custom_fields']['fieldgroup1']['template'] = 'geo.html'
In template template/inc_cntpart/imagespecial/geo.html
use [IMGSPCL_XXXX]{IMGSPCL_XXXX}[/IMGSPCL_XXXX]
Replacement Tags.
<!--IMAGES_ENTRY_START//-->
<div
[IMGSPCL_LON]data-lon="{IMGSPCL_LON}" [/IMGSPCL_LON]
[IMGSPCL_LAT]data-lat="{IMGSPCL_LAT}" [/IMGSPCL_LAT]
class="imageEntry[FIRST] first[/FIRST][LAST] last[/LAST][ROW] row{ROW}[/ROW]"
id="img{IMGID}">
<img class="tilt" src="{THUMB_ABS}" alt="">
</div>
<!--IMAGES_ENTRY_END//-->
Artikelendzeit hochsetzen
# query first
SELECT * from phpwcms_article WHERE (article_end between '2017-11-01' AND '2020-12-30') AND article_deleted=0 and article_public=1
ORDER BY `phpwcms_article`.`article_end` ASC
UPDATE phpwcms_article SET article_end = '2030-12-11 23:59:59' WHERE article_end > NOW() AND article_deleted=0;
Frontend Snippets
Build Links
// function rel_url($add=array(), $remove=array(), $id_alias='', $format='htmlspecialchars', $glue='&', $bind='=') {}
// function abs_url($add=array(), $remove=array(), $id_alias='', $format='htmlspecialchars', $glue='&', $bind='=') {}
$link = rel_url(['key' => 'value', 'token' => 'xyz'], [], 'article-alias');
// => '/article-alias.html?key=value&token=xyz'
CP Form
File
maxlength="5242880"
accept="pdf"
folder="content/form"
attachment=0
exclude="php,js"
regexp="/[pdf]/"