11
worlds
Can I have multiple instances of a block?
  • 2004/4/12 2:33

  • worlds

  • Just popping in

  • Posts: 61

  • Since: 2004/3/13


Hi -

I know I can edit xoops_versions.php to have multiple instances of a block, but is there some easy way to let people add another copy of a block via the admin interface?

I hate to tell people to go edit xoops_versions.php to change their UI.

Tom
P.S. Why? Imagine that someone is setting up a bookstore, and wants to use the block that displays a single book cover in both the upper left and upper right corners of a page.



12
worlds
Is there a way to set the title of a module on install
  • 2004/4/9 23:03

  • worlds

  • Just popping in

  • Posts: 61

  • Since: 2004/3/13


Hi -

I'd like to set the title of my block when it is installed.

I know how to change it after it is installed, but not how to get it to start with the title I want.

And no, I don't want the title and the name to be the same.

Tom



13
worlds
Re: Blocks
  • 2004/4/7 9:25

  • worlds

  • Just popping in

  • Posts: 61

  • Since: 2004/3/13


It's sort of a feature. If your database query returns 0 rows, then the block doesn't show.

It's usually what you want.

Except maybe when debugging.

Tom



14
worlds
Sample Trivial Block for Debugging
  • 2004/4/7 9:22

  • worlds

  • Just popping in

  • Posts: 61

  • Since: 2004/3/13


Hi -

One of the things I did when I was getting annoyed writing blocks, was write a debug block. It's just about the simplest block you can do, so there's very little to go wrong. I can start by installing it, then I can make sure I have everything right for the simple case. Then I can add code from my real block, until I can see what causes a problem.

Note that while I was just off cleaning this up, it was not showing up for me, even after repeated reloads of the module. I uninstalled the module, and re-installed it, and there it was. So try that, too.


Here are the parts of my block:

from xoops_version.php:
$modversion['blocks'][1]['file'] = "debugblock.php";
$modversion['blocks'][1]['name'] = "Bookstore: Debug Block";
$modversion['blocks'][1]['description'] = "Only used for debugging";
$modversion['blocks'][1]['show_func'] = "b_bookstore_debug";
$modversion['blocks'][1]['template'] = 'bookstore_debug.html';


Start your block indexes at 1, not zero.!

And this forum keeps changing the code I'm posting below for debugblock.php. It keeps turning my urls in debugblock.php into a hyperlink.

So when copying and pasting the section below, make sure you paste the code below as text, not HTML. the values in the array should just be
h t t p : // www.worldware.com, and not
a href h t t p: // www.worldware.com

Note to XOOPS team: things within code blocks should not be altered. That's a bug!

blocks\debugblock.php:


<?php
function b_bookstore_debug()

{
$sites = array
(
"xoops.org" => "https://xoops.org",
"worldware.com" => "http://www.worldware.com"
);
$block = array();
$link = array();
foreach ($sites as $site => $url)
{
$link['site'] = $site;
$link['url'] = $url;
$block['links'][] = $link;
}
return $block;
}
?>


templates\blocks\bookstore_debug.html:
<div class="blockContent">
    <
table border="3">
        <{foreach 
item=link from=$block.links}>
        <
tr>
            <
td><a href="<{$link.url}>"><{$link.site}></a></td>
        </
tr>
        <{/foreach}>
    </
table>
</
div>



15
worlds
Re: Blocks
  • 2004/4/7 8:50

  • worlds

  • Just popping in

  • Posts: 61

  • Since: 2004/3/13


I know exactly how you feel. I had the same experience when starting to write for xoops.

I don't know if it's worth much, but I wrote up an article on debugging xoops, and posted it on my site.

http://www.worldware.com/modules/sections/index.php?op=viewarticle&artid=2

I don't know if it will help. Most of it is obvious. Right after someone tells you

Comments are welcome.

Tom



16
worlds
Re: Reloading templates fails. Sometimes...
  • 2004/4/6 0:55

  • worlds

  • Just popping in

  • Posts: 61

  • Since: 2004/3/13


Well, that did seem to make the reloading problem go away.

I wonder why?

Tom



17
worlds
Re: Sorting lists in the admin web interface
  • 2004/4/6 0:53

  • worlds

  • Just popping in

  • Posts: 61

  • Since: 2004/3/13


And, just to reply to my own post, I'll observe that sorting has more value if blocks are named consistently.

All of the bookstore blocks have names that start with "bookstore:", so I don't have to hunt for them.

I'd encourage other module developers to do the same.

Tom



18
worlds
Re: Sorting lists in the admin web interface
  • 2004/4/6 0:49

  • worlds

  • Just popping in

  • Posts: 61

  • Since: 2004/3/13


Why toggle? The current order appears random. Does it have some value that should be preserved?

If not, simpler to not add a UI item to toggle on/off.

I really think that all of XOOPS need to sort lists. Randomly hunting for things in the UI is not an efficient use of time.

Tom



19
worlds
Bookstore Comments
  • 2004/4/6 0:46

  • worlds

  • Just popping in

  • Posts: 61

  • Since: 2004/3/13


Sounds like a problem for me, too. I was looking at adding comments to the bookstore module, but the bookstore is keyed off of the amazon id, which is a large alphanumeric field (e.g. B0000AXE8I).

I could make a dummy "id for comments" field, but that wouldn't work as well, for a number of reasons.

Any suggestions?

Tom



20
worlds
Re: Multilingo for the bookstore?
  • 2004/4/6 0:18

  • worlds

  • Just popping in

  • Posts: 61

  • Since: 2004/3/13


I'm trying to make the next version more international friendly.

Perhaps someone can explain to me a simple way to use the defines in languages/xxx/template.php in templates directly.

If I have

define("_AM_BOOKSTORE_LANG_AUTHOR", "Authors");

I'd like to put something like the following in the template code:

<{$_AM_BOOKSTORE_LANG_AUTHOR}>

But it doesn't work.

I can just make a list of all the entries in the defines, like this:

$intl = array
(
"error" =>_AM_BOOKSTORE_LANG_ERROR,
"author" =>_AM_BOOKSTORE_LANG_AUTHOR,
"sales_rank" =>_AM_BOOKSTORE_LANG_SALES_RANK,
"publisher" =>_AM_BOOKSTORE_LANG_PUBLISHER,
"published" =>_AM_BOOKSTORE_LANG_PUBLISHED,
"our_price" =>_AM_BOOKSTORE_LANG_OUR_PRICE,
"more_info" =>_AM_BOOKSTORE_LANG_MORE_INFO,
"notice" =>_AM_BOOKSTORE_LANG_PLEASE_NOTE,
);

And pass it into the template. It just seems inefficient to have to define the extra list.

Any suggestions?

Tom






TopTop
« 1 (2) 3 4 »



Login

Who's Online

239 user(s) are online (144 user(s) are browsing Support Forums)


Members: 0


Guests: 239


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits