Announcement

  •  » Extensions
  •  » Theme: PaysonsPlaces [Advanced Menu Manager]

#1 2011-06-21 07:35:38

tearran
Member
2011-06-03
10

Theme: PaysonsPlaces [Advanced Menu Manager]

I am trying to make my theme  [extension by tearran] PaysonsPlaces svn compatible with AMenuManager without haveing to modify outside my theme I have never wrote a php script before. here is what I have so far

Code:

themeconf.inc.php

<?php
/* Did a lot of searches yay Google*/
$connect = mysql_connect("localhost","$username","$password") ;
$database = "$database_name" ; 
$select = mysql_select_db($database, $connect);
$query = "SELECT * FROM piwi_plugins WHERE id='AMenuManager'";
$result = mysql_query($query) ;
$row = mysql_fetch_array($result);
$cell = $row['state'];
?>

Code:

footer.tpl
{if ($cell != "inactive")}
 /*  remove "AMenuManager" from menu */

/* Place "AMenuManager" in the footer */

/* this showed "A random picture" text in the footer */
{include file=$path_to_amm}

/* not sure if {else} is needed */
{else}  
{""}

{/if}

I did find smarty modifier replace
no clue if this would work or not tried Example with themeconf.inc.php and footer.tpl only got Undefined variable: error. Please keep in mind  php is really new to me.  HTML and simple js was my thing.
Any help would be great.

Offline

 

#2 2011-06-21 11:13:12

flop25
Piwigo Team
2006-07-06
7037

Re: Theme: PaysonsPlaces [Advanced Menu Manager]

hello

ho you have the same idea as me : put the random block in the footer
Due a lack of time I haven't tried, but what I can say when I look your php code is "Omg !" ^^
Piwigo has already a lot of functions like the one for database query : pwg_query()
However it would be better to ask to grum if he has an idea of how to do. I notify him right now

ps : there are two ideas : bypassing the plugin to load the block in the footer or copying the block in the theme. The second would be better to allow more compatibility with the theme... piwigo doesn't have yet a widget system as wordpress

Last edited by flop25 (2011-06-21 11:18:15)


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#3 2011-06-21 20:12:19

grum
Former Piwigo Team
Pantin
2007-09-10
1371

Re: Theme: PaysonsPlaces [Advanced Menu Manager]

It will not be easy to implement..

The plugin use the template ./menu_templates/menubar_randompic.tpl to initialize the block menu.

The result is placed in a <dl> markup which id equals "mbAMM_randompic", it looks something like this:

Code:

<dl id="mbAMM_randompict">
  <dt>{$block->get_title()}</dt>

  <dd id="irandompicdd" class="randompicdd">
    <div id="irandompicinner" class="illustration">
      <div class="ammillustrationc">
        <div id="iamm_ill0" class="ammillustration">
          <span id='iammRPicNameO' style='display:none;'></span>
          <span id='iammRPicCommentO' style='display:none;'></span>
          <a id='iammRPicLink' ><img id="iammRPicImg"/></a>
          <span id='iammRPicNameU' style='display:none;'></span>
          <span id='iammRPicCommentU' style='display:none;'></span>
        </div>
      </div>
    </div>
  </dd>
</dl>

In your template, you have to implement some javascript for:
- check if the #irandompicinner item exists
- then, move the markup identified by id #irandompicinner in the new position (where you want to have the random image) and after move was done, remove the markup identified by id #mbAMM_randompict

The JS code have to be executed when the page is loaded.


My pictures with Piwigo, of course !
[ www.grum.fr ]

Offline

 
  •  » Extensions
  •  » Theme: PaysonsPlaces [Advanced Menu Manager]

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact