Lay-out iPad php versie 7

Nederlandse ondersteuning voor CMS Made Simple

Moderator: velden

User avatar
Gregor
Power Poster
Power Poster
Posts: 1874
Joined: Thu Mar 23, 2006 9:25 am

Re: Lay-out iPad php versie 7

Post by Gregor »

Die werkt Rolf. Dank je.

Nu zag ik dat er in Gallery nog een aantal fouten zit:
Notice: Undefined index: pid in /home/efacti/public_html/uisge-beatha.eu/www/tmp/templates_c/Gallery^1eefdc88d1634b3a1d36be5351d15c63baf61534.module_db_tpl.Gallery;Floatbox_SocMedia.php on line 154
Kajuitramen
Kajuitramen

Notice: Undefined index: pid in /home/efacti/public_html/uisge-beatha.eu/www/tmp/templates_c/Gallery^1eefdc88d1634b3a1d36be5351d15c63baf61534.module_db_tpl.Gallery;Floatbox_SocMedia.php on line 154

Errorlog server
[30-Mar-2017 14:25:48 UTC] PHP Notice: Undefined index: pid in /home/efacti/public_html/uisge-beatha.eu/www/tmp/templates_c/Gallery^1eefdc88d1634b3a1d36be5351d15c63baf61534.module_db_tpl.Gallery;Floatbox_SocMedia.php on line 154
[30-Mar-2017 14:25:48 UTC] PHP Notice: Undefined index: pid in /home/efacti/public_html/uisge-beatha.eu/www/tmp/templates_c/Gallery^1eefdc88d1634b3a1d36be5351d15c63baf61534.module_db_tpl.Gallery;Floatbox_SocMedia.php on line 154
[30-Mar-2017 14:25:48 UTC] PHP Notice: Undefined index: pid in /home/efacti/public_html/uisge-beatha.eu/www/tmp/templates_c/Gallery^1eefdc88d1634b3a1d36be5351d15c63baf61534.module_db_tpl.Gallery;Floatbox_SocMedia.php on line 154
[30-Mar-2017 14:25:48 UTC] PHP Notice: Undefined index: pid in /home/efacti/public_html/uisge-beatha.eu/www/tmp/templates_c/Gallery^1eefdc88d1634b3a1d36be5351d15c63baf61534.module_db_tpl.Gallery;Floatbox_SocMedia.php on line 154
[30-Mar-2017 14:25:48 UTC] PHP Notice: Undefined index: pid in /home/efacti/public_html/uisge-beatha.eu/www/tmp/templates_c/Gallery^1eefdc88d1634b3a1d36be5351d15c63baf61534.module_db_tpl.Gallery;Floatbox_SocMedia.php on line 154
[30-Mar-2017 14:25:48 UTC] PHP Notice: Undefined index: pid in /home/efacti/public_html/uisge-beatha.eu/www/tmp/templates_c/Gallery^1eefdc88d1634b3a1d36be5351d15c63baf61534.module_db_tpl.Gallery;Floatbox_SocMedia.php on line 154
[30-Mar-2017 14:25:48 UTC] PHP Notice: Undefined index: pid in /home/efacti/public_html/uisge-beatha.eu/www/tmp/templates_c/Gallery^1eefdc88d1634b3a1d36be5351d15c63baf61534.module_db_tpl.Gallery;Floatbox_SocMedia.php on line 154
De aangepaste codes werken.

Code: Select all

{if $imagecount != 0}
aangepast naar:

Code: Select all

{if !empty($imagecount)}

Code: Select all

{if $entry->canonical}
          {assign var='canonical' value=$entry->canonical} 
{/if}
{$canonical}
aangepast naar:

Code: Select all

{if (isset($entry->canonical))}
                {assign var='canonical' value={$entry->canonical}}
{/if}
{$canonical}

De code van de UDT 'canonical' is:

Code: Select all

global $gCms;
if ($gCms->variables['page_name'] !='') {
	$manager =& $gCms->GetHierarchyManager();
	$node =& $manager->sureGetNodeByAlias($gCms->variables['page_id']);
	
	$content =& $node->GetContent();
	if (isset($content) && is_object($content))
	{
		if ($content->GetURL() != '')
		{
		echo '<link rel="canonical" href="'.$content->GetURL().'" />';
		}
	}
}
Denk dat daar nog een fout in zit, maar ben er nog niet uit welke.

Code: Select all

{if $smarty.get.pid && $smarty.get.pid == $image->fileid}
aangepast naar:

Code: Select all

{if isset($smarty.get.pid) AND $smarty.get.pid == $image->fileid}
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: Lay-out iPad php versie 7

Post by Rolf »

De code van de UDT 'canonical' is:
Code:
global $gCms;
if ($gCms->variables['page_name'] !='') {
$manager =& $gCms->GetHierarchyManager();
$node =& $manager->sureGetNodeByAlias($gCms->variables['page_id']);

$content =& $node->GetContent();
if (isset($content) && is_object($content))
{
if ($content->GetURL() != '')
{
echo '<link rel="canonical" href="'.$content->GetURL().'" />';
}
}
}
Wat doe je hier?

Lijkt me behoorlijk omslachtig...

Zie https://www.cmscanbesimple.org/blog/bas ... d-metatags

In de template top:
{$canonical_url = "{$content_obj->GetURL()|lower|default:''}" scope=global}

In the <head>:
<link rel="canonical" href="{$canonical_url}">

In CGBlog detail template:
{$canonical_url = $entry->canonical|lower scope=global}
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
User avatar
Gregor
Power Poster
Power Poster
Posts: 1874
Joined: Thu Mar 23, 2006 9:25 am

Re: Lay-out iPad php versie 7

Post by Gregor »

Dit is in Gallery ooit bedacht om bij het weergeven van een foto (in Floatbox) onderin buttons te plaatsen waarmee je de foto op social media kan zetten. Kijk ter illustratie eens op deze link en klik een foto aan:
https://www.uisge-beatha.eu/gallery/Zom ... 20-45.html

Als het handiger kan...
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: Lay-out iPad php versie 7

Post by Rolf »

Makkelijker... nou ja, in ieder geval zou je er geen UDT voor nodig moeten hebben.

Wil je de Gallery template hier eens neer zetten?
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
User avatar
Gregor
Power Poster
Power Poster
Posts: 1874
Joined: Thu Mar 23, 2006 9:25 am

Re: Lay-out iPad php versie 7

Post by Gregor »

:D

Code: Select all

{$canonical_url = "{$content_obj->GetURL()|lower|default:''}" scope=global}

<div class="gallery">
    {if !empty($gallerytitle)}<h3>{$gallerytitle}</h3>{/if}
    <div class="albumcomment">
        <p>{if !empty($imagecount)}{$imagecount}{else}Albums{/if} related to Uisge Beatha. <a href="{cms_selflink href='gastenboek'}">You're most welcome to leave a message.</a></p>
        {if !empty($gallerycomment)}{$gallerycomment}{/if}
    </div>
    
    <div class="pagenavigation">
    {if $pages > 1}
        <div class="prevpage">{$prevpage}</div>
        <div class="nextpage">{$nextpage}</div>
    {/if}
    {if !$hideparentlink && !empty($parentlink)}<div class="parentlink">{$parentlink}</div>{/if}
    {if $pages > 1}<div class="pagelinks">{$pagelinks}</div>{/if}
</div>

<ul class="picturelist">
{foreach from=$images item=image}
    {assign var='sm' {$image->file|escape:'url'|replace:'%2F':'/'} nocache}
    {if $sm|substr:-7:3 neq "_sm"}
    <li class="thumb">
	{if $image->isdir}
		<a href="{$image->file}" title="{$image->titlename}"><img itemprop="image" src="{$image->thumb|escape:'url'|replace:'%2F':'/'}" alt="{$image->titlename}" /></a>
		<div style="float:center">
            {$image->titlename}
        </div>
	{else}
        {assign var="imagetitlename" {$image->titlename|replace:' ':'_'} nocache}
        {assign var="imagefileurl" {$image->file|escape:'url'|replace:'%2F':'/'} nocache}
        {assign var="imagethumburl" {$image->thumb|escape:'url'|replace:'%2F':'/'} nocache}
        <div id="TweetGallery-{$image->fileid}" style="display:none;">
            <!-- twtext={$imagetitlename} twurl={$imagefileurl} -->
            {GalleryTweet twtext=$imagetitlename twurl=$imagefileurl}
            {GalleryPinterest twtext=$imagetitlename twurl=$imagefileurl}<br/>
            
            {* FACEBOOK URL MET EXTRA pid parameter *}
            <fb:like href="{$image->gallery_url}?pid={$image->fileid}" send="false" layout="button_count" width="120" show_faces="true" font="lucida grande"></fb:like>
                
            {if (isset($entry->canonical))}
                {assign var='canonical' value={$entry->canonical}}
            {/if}
            {$canonical}
            {assign var='get_title' value={$imagetitlename}}
            {assign var='detail_page' value='fotoalbum'}

            {* REGEL HIERONDER UITGESCHAKELD !!!*}
            {*capture assign='fb_image'}{$image->file|escape:'url'|replace:'%2F':'/'}{/capture*}
        </div>

        {* ANCHOR VOORZIEN VAN id=pid-xxx *}
        {* data-fb-options="group:gallery-{$galleryid} ================ rel="gallery-{$galleryid}" *}
        <a id="pid-{$image->fileid}" class="albumnav floatbox" href="{$imagefileurl}" data-fb-options="group:gallery-{$galleryid} caption:#TweetGallery-{$image->fileid}"title="{$imagetitlename}"><img itemprop="image" src="{$imagethumburl}" alt="{$imagetitlename}" /></a>
    {/if}
	</li>
	{/if}

    {* WIJZIGINGEN VOOR FACEBOOK *}
    {if isset($smarty.get.pid) AND $smarty.get.pid == $image->fileid} 
        {assign var='tst_pidfound' value=1}
        {assign var='tst_ogtitle' value=$image->titlename}
        {*assign var='tst_ogdescription' value=$image->comment*}
        {capture name='tstogdescription' assign='tst_ogdescription'}{if !empty($gallerytitle)}{$gallerytitle}<br/>{/if}{if !empty($image->comment)}{$image->comment}<br/>}{/if}{$imagetitlename}{/capture}
        {capture name='tstogurl' assign='tst_ogurl'}{$image->gallery_url}?pid={$image->fileid}{/capture}
        {capture name='tstanchorid' assign='tst_anchorid'}pid-{$image->fileid}{/capture}
        {capture name='tstfbimage' assign='fb_image'}{root_url}/{$imagefileurl}{/capture}
    {* EINDE WIJZIGINGEN VOOR FACEBOOK *}
    {/if}
{/foreach}
</ul>
<div class="galleryclear">&nbsp;</div>
</div>
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: Lay-out iPad php versie 7

Post by Rolf »

Boven in het template gebruik je:
{$canonical_url = "{$content_obj->GetURL()|lower|default:''}" scope=global}

Halverwege:
{if (isset($entry->canonical))}
{assign var='canonical' value={$entry->canonical}}
{/if}
{$canonical} <--- die mag er sowieso niet staan en kan de foutmelding geven.

Verder werk je dus met $canonical_url en $canonical. Een dubbele naam voor hetzelfde?
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
User avatar
Gregor
Power Poster
Power Poster
Posts: 1874
Joined: Thu Mar 23, 2006 9:25 am

Re: Lay-out iPad php versie 7

Post by Gregor »

Ja sorry, die bovenste was ter test.

Als ik die gebruik en het hele tweede stuk canonical weghaal, dan werkt tie.

Wat er denk ik aan de hand is, is dat Gallery een paar jaar geleden eerst is aangepast om met socialmedia te werken en canonical toe te voegen en dat met de aanpassing van de site er een nieuwe vorm canonical is geïntroduceerd.

Zal de UDT markeren dat deze tzt weg kan.

Ik heb de errorlog in cpanel aangezet om te of er nog andere meldingen komen. Het is me wel duidelijk geworden dat overstappen naar php 7 niet 1-2-3 is gedaan, althans voor mij ;)

Dank voor je/jullie hulp om te een oplossing te komen :)
User avatar
Gregor
Power Poster
Power Poster
Posts: 1874
Joined: Thu Mar 23, 2006 9:25 am

Re: Lay-out iPad php versie 7

Post by Gregor »

Zo denk je dat je er bent.....
Error log geeft een Undefined index op year
[30-Mar-2017 20:47:37 UTC] PHP Notice: Undefined index: year in /home/efacti/public_html/uisge-beatha.eu/www/tmp/templates_c/dd06051ff96302c594f48d0d81e7b944959d9fd6.module_db_tpl.CGBlog;archiveSample.php on line 173
[30-Mar-2017 20:47:37 UTC] PHP Notice: Undefined index: year in /home/efacti/public_html/uisge-beatha.eu/www/tmp/templates_c/dd06051ff96302c594f48d0d81e7b944959d9fd6.module_db_tpl.CGBlog;archiveSample.php on line 173
[30-Mar-2017 20:47:37 UTC] PHP Notice: Undefined index: year in /home/efacti/public_html/uisge-beatha.eu/www/tmp/templates_c/dd06051ff96302c594f48d0d81e7b944959d9fd6.module_db_tpl.CGBlog;archiveSample.php on line 173
[30-Mar-2017 20:47:37 UTC] PHP Notice: Undefined index: year in /home/efacti/public_html/uisge-beatha.eu/www/tmp/templates_c/dd06051ff96302c594f48d0d81e7b944959d9fd6.module_db_tpl.CGBlog;archiveSample.php on line 173
[30-Mar-2017 20:47:53 UTC] PHP Notice: Undefined index: cgblog_id in /home/efacti/public_html/uisge-beatha.eu/www/lib/classes/class.usertagoperations.inc.php(278) : eval()'d code on line 67

Code: Select all

{if isset($archivelist)}
  <ul class="archivelist">
  {foreach from=$archivelist item=one}
    <li>
      <a href="{$one.summary_url}"> {$one.datestamp|date_format:"%B"} {$one.datestamp|date_format:"%Y"}</a> ({$one.count})
      <div class="articles">
        {capture assign='theyear'}{$one.datestamp|date_format:"%Y"}{/capture}
        {capture assign='themonth'}{$one.datestamp|date_format:"%m"}{/capture}
        {CGBlog year='$theyear' month='$themonth' summarytemplate="Jaar_Maand"}
      </div>
    </li>
  {/foreach}
  </ul>
{/if}
Geen foutmeldingen op month en wel op year. Gecontroleerd met {$theyear} en daar staat een jaar in ???
Jos
Support Guru
Support Guru
Posts: 4020
Joined: Wed Sep 05, 2007 8:03 pm

Re: Lay-out iPad php versie 7

Post by Jos »

{CGBlog year=$theyear month=$themonth summarytemplate="Jaar_Maand"}

zonder de quotes dus?

en de captures zijn eigenlijk overbodig en ongewenst
User avatar
Gregor
Power Poster
Power Poster
Posts: 1874
Joined: Thu Mar 23, 2006 9:25 am

Re: Lay-out iPad php versie 7

Post by Gregor »

quotes aangepast, capture vervangen door assign en theyear op verschillende wijzen geprobeerd (zie commentaar) te voorzien van een waarde, maar de fout blijft.
[31-Mar-2017 04:41:25 UTC] PHP Notice: Undefined index: year in /home/efacti/public_html/uisge-beatha.eu/www/lib/smarty/sysplugins/smarty_internal_templatebase.php(165) : eval()'d code on line 167
[31-Mar-2017 04:41:25 UTC] PHP Notice: Undefined index: year in /home/efacti/public_html/uisge-beatha.eu/www/lib/smarty/sysplugins/smarty_internal_templatebase.php(165) : eval()'d code on line 167
[31-Mar-2017 04:41:25 UTC] PHP Notice: Undefined index: year in /home/efacti/public_html/uisge-beatha.eu/www/lib/smarty/sysplugins/smarty_internal_templatebase.php(165) : eval()'d code on line 167
[31-Mar-2017 04:41:25 UTC] PHP Notice: Undefined index: year in /home/efacti/public_html/uisge-beatha.eu/www/lib/smarty/sysplugins/smarty_internal_templatebase.php(165) : eval()'d code on line 167

Code: Select all

{if isset($archivelist)}
  <ul class="archivelist">
  {foreach from=$archivelist item=one}
    <li>
      <a href="{$one.summary_url}"> {$one.datestamp|date_format:"%B"} {$one.datestamp|date_format:"%Y"}</a> ({$one.count})
      <div class="articles">
        {assign var='theyear' value=$one.year}
        {* assign var='theyear' value=$one.datestamp|date_format:"%Y" *}
        {assign var='themonth' value=$one.datestamp|date_format:"%m"}
        {CGBlog year=$theyear month=$themonth summarytemplate="Jaar_Maand"}
      </div>
    </li>
  {/foreach}
  </ul>
{/if}
De output https://www.uisge-beatha.eu/Logboek_ove ... bjaar.html lijkt ook niet overeen te komen met de template. De template Jaar_Maand:

Code: Select all

{foreach from=$archivelist item=one}
{if $lastused!=$one.year}
   <div class="articles">
     <h2>Logboek over {$one.year}</h2>
     {CGBlog year=$one.year archivetemplate="Jaar_Maand"}
   </div>
   {assign var='lastused' value=$one.year}
{/if}
{/foreach}
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: Lay-out iPad php versie 7

Post by Rolf »

Code: Select all

{CGBlog year=$one.datestamp|date_format:'%Y' month=$one.datestamp|date_format:'%m' summarytemplate='Jaar_Maand'}
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
User avatar
Gregor
Power Poster
Power Poster
Posts: 1874
Joined: Thu Mar 23, 2006 9:25 am

Re: Lay-out iPad php versie 7

Post by Gregor »

Rolf wrote:

Code: Select all

{CGBlog year=$one.datestamp|date_format:'%Y' month=$one.datestamp|date_format:'%m' summarytemplate='Jaar_Maand'}
Deze variant had ik inderdaad ook al geprobeerd, nogmaals gedaan, maar blijft fouten op year geven:
[31-Mar-2017 14:19:18 UTC] PHP Notice: Undefined index: year in /home/efacti/public_html/uisge-beatha.eu/www/lib/smarty/sysplugins/smarty_internal_templatebase.php(165) : eval()'d code on line 160
[31-Mar-2017 14:19:18 UTC] PHP Notice: Undefined index: year in /home/efacti/public_html/uisge-beatha.eu/www/lib/smarty/sysplugins/smarty_internal_templatebase.php(165) : eval()'d code on line 160
[31-Mar-2017 14:19:18 UTC] PHP Notice: Undefined index: year in /home/efacti/public_html/uisge-beatha.eu/www/lib/smarty/sysplugins/smarty_internal_templatebase.php(165) : eval()'d code on line 160
Raar idee misschien, maar zou het met het datumformaat uit de Global setting te maken kunnen hebben? Bij mij staat %d %b %Y
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: Lay-out iPad php versie 7

Post by Rolf »

Maar wordt $year niet ergens *in* het sjabloon gebruikt en struikelt hij daar over...
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Lay-out iPad php versie 7

Post by velden »

Undefined index: year
Dit betekent normaal gesproken dat er een index wordt aangeroepen van een array die die index niet heeft;

Dus notatie á là $foo.index of $foo[index].

In dit geval zou ik dan verwachten bij zoiets als

Code: Select all

{assign var='theyear' value=$one.year}
De oplossing is altijd simpel: eerst checken of the variabele index wel bestaat:

Code: Select all

{if isset($one.year)}
  {assign var='theyear' value=$one.year}
{/if}
Natuurlijk is het niet zo simpel als je verwacht dat die $one.year altijd bestaat. Maar dan zit er ergens anders iets fout.
User avatar
Gregor
Power Poster
Power Poster
Posts: 1874
Joined: Thu Mar 23, 2006 9:25 am

Re: Lay-out iPad php versie 7

Post by Gregor »

@Rolf: alle sjablonen doorzocht op $year en ook Search Admin gebruikt, maar helaas.

@velden: klinkt logisch. in beide archive templates jouw code ingevoer, maar helaas. De melding in de errorlog blijft.

Nog even een check met php 5.6 gedaan. Het goede nieuws is dat daarmee ook dezelfde foutmelding verschijnt.

Zou het een bug in de programmatuur kunnen zijn waardoor year niet goed wordt verwerkt?
Post Reply

Return to “Dutch - Nederlands”