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
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']; ?>
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
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)
Offline
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:
<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.
Offline