ezPortal

Started by SMFHacks.com Team, November 02, 2008, 10:10:03 AM

Previous topic - Next topic

Magicjax

First of all. Great mod! I got it working great now.

I'm trying to install a banner rotator that displays a new banner on each page load or page reload. THe banner shows up but it doesn't link to where I set it to link to and the banner images don't change on reload. It always show the first banner and when I click the link it just reloads the page.

I have 3 different banners and 3 different links and they are all set to the right location. But it still won't work. Any idea what the problem is?

Here's my code.


<script type="text/javascript">
var imgs1 = new Array("http://www.magictalk.com/images/mtbanner.jpg","http://www.magictalk.com/images/mtbanner2.jpg","http://www.magictalk.com/images/mtbanner3.jpg");
var lnks1 = new Array("http://www.magicjax.com","http://www.streetofcard.com","http://www.magictalk.com");
var alt1 = new Array("Banner 1","Banner 2","Banner 3");
var currentAd1 = 0;
var imgCt1 = 3;
function cycle1() {
  if (currentAd1 == imgCt1) {
    currentAd1 = 0;
  }
var banner1 = document.getElementById('adBanner1');
var link1 = document.getElementById('adLink1');
  banner1.src=imgs1[currentAd1]
  banner1.alt=alt1[currentAd1]
  document.getElementById('adLink1').href=lnks1[currentAd1]
  currentAd1++;
}
  window.setInterval("cycle1()",10000);
</script>
<a href=""http://www.magictalk.com"" id="adLink1" target="_top">
<img src="http://www.magictalk.com/images/mtbanner.jpg" id="adBanner1" border="0" width="468" height="60"></a>


Magicjax

It's been quite a while with no reply to my issue. So am I to take it that it's not possible to install a javascript in a Box?

Just to show you what I need to work out. If you look at my forum here:
http://magictalk.com/forum/index.php

You'll see I have two boxes. One on the right and one centered at the top.

The one on the top I need to put a banner rotator that will load a new banner when the page reloads.

The box on the right I need a script that will place the images in random order.

I've found scripts that do what I need to do. But none of them will work in the EzPortal boxes.

We're about to launch this forum so I really need to find a way to figures these out. Any help would be greatly appreciated.

Ron

vbgamer45

What does the code of the page look like we boxes included?
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

cubetgio

Quote from: cubetgio on May 15, 2009, 07:06:48 AM
Hello

I'm testing links permissions with 1.1.8.

It seems that it's not working when you deny access to a category of links to a specific member group(guest).

The link is opening independently of the fact that you deny access to.

G.

Hello VBgamer,

any idea on what is wrong with ezlinks box permission and duplication of links when creating a second links box

vbgamer45

The permission issue was not built into the ezBlock which is why it did not work.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Fat_Man


Big thumbs up to this Modification.

Works well with the Dilber theme (just in case anybody else is using this theme)


vbgamer45

Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Yahmez

1st off, Great portal!
I have a question though. I edited the poll block code to work with the colored bars mod. I have it set up and it works for me exactly how I want it, BUT it fills my error log up very quickly. Is there any way you could help me figure out where the error is?

This is what the error log keeps showing:
2: Missing argument 2 for EzBlockPollBlock()File: /xxxx/xxxxxx/xxxxx/Sources/Subs-EzPortalMain.phpLine: 972

Here is the edited portion of code from subs-ezportalmain file. function EzBlockPollBlock($paramters = array(), $pollTopicID, $startHtml = '', $endHtml = '')
{
    global $db_prefix, $txt, $ID_MEMBER, $settings, $boardurl, $sc, $user_info;
    global $context;
   

    // Pass all the parematers
    foreach($paramters as $myparam)
    {
        if ($myparam['parameter_name'] == 'pollTopicID')
            $pollTopicID = (int) $myparam['data'];

       
    }
   
    $topic = (int) $pollTopicID;
   
    // Html Header
    echo $startHtml;


    $boardsAllowed = boardsAllowedTo('poll_view');

    if (empty($boardsAllowed))
        return array();



    $request = db_query("
        SELECT
            p.ID_POLL, p.question, p.votingLocked, p.hideResults, p.expireTime, p.maxVotes
        FROM ({$db_prefix}topics AS t, {$db_prefix}polls AS p, {$db_prefix}boards AS b)
        WHERE p.ID_POLL = t.ID_POLL
            AND t.ID_TOPIC = $topic
            AND b.ID_BOARD = t.ID_BOARD
            AND $user_info[query_see_board]" . (!in_array(0, $boardsAllowed) ? "
            AND b.ID_BOARD IN (" . implode(', ', $boardsAllowed) . ")" : '') . "
        LIMIT 1", __FILE__, __LINE__);

    // Either this topic has no poll, or the user cannot view it.
    if (mysql_num_rows($request) == 0)
        return array();

    $row = mysql_fetch_assoc($request);
    $pollinfo = $row;
    mysql_free_result($request);

    // Check if they can vote.
    if (!empty($row['expireTime']) && $row['expireTime'] < time())
        $allow_vote = false;
    elseif ($user_info['is_guest'] || !empty($row['votingLocked']) || !allowedTo('poll_vote'))
        $allow_vote = false;
    else
    {
        $request = db_query("
            SELECT ID_MEMBER
            FROM {$db_prefix}log_polls
            WHERE ID_POLL = $row[ID_POLL]
                AND ID_MEMBER = $ID_MEMBER
            LIMIT 1", __FILE__, __LINE__);
        $allow_vote = mysql_num_rows($request) == 0;
        mysql_free_result($request);
    }

    $request = db_query("
        SELECT COUNT(DISTINCT ID_MEMBER)
        FROM {$db_prefix}log_polls
        WHERE ID_POLL = $row[ID_POLL]", __FILE__, __LINE__);
    list ($total) = mysql_fetch_row($request);
    mysql_free_result($request);

    $request = db_query("
        SELECT ID_CHOICE, label, votes
        FROM {$db_prefix}poll_choices
        WHERE ID_POLL = $row[ID_POLL]", __FILE__, __LINE__);
    $options = array();
    $total_votes = 0;
    while ($rowChoice = mysql_fetch_assoc($request))
    {
        censorText($rowChoice['label']);

        $options[$rowChoice['ID_CHOICE']] = array($rowChoice['label'], $rowChoice['votes']);
        $total_votes += $rowChoice['votes'];
    }
    mysql_free_result($request);

    $return = array(
        'id' => $row['ID_POLL'],
        'image' => empty($pollinfo['votingLocked']) ? 'poll' : 'locked_poll',
        'question' => $row['question'],
        'total_votes' => $total,
        'is_locked' => !empty($pollinfo['votingLocked']),
        'allow_vote' => $allow_vote,
        'topic' => $topic
    );

    // Calculate the percentages and bar lengths...
    $divisor = $total_votes == 0 ? 1 : $total_votes;
    foreach ($options as $i => $option)
    {
        $bar = floor(($option[1] * 100) / $divisor);
        $barWide = $bar == 0 ? 1 : floor(($bar * 5) / 6);
        $return['options'][$i] = array(
            'id' => 'options-' . $i,
            'percent' => $bar,
            'votes' => $option[1],
            'bar' => '<span style="white-space: nowrap;"><img src="' . $settings['images_url'] . '/poll/poll_left_c' . $i%10 . '.gif" alt="" /><img src="' . $settings['images_url'] . '/poll/poll_middle_c' . $i%10 . '.gif" width="' . $barWide . '" height="12" alt="-" /><img src="' . $settings['images_url'] . '/poll/poll_right_c' . $i%10 . '.gif" alt="" /></span>',
            'option' => parse_bbc($option[0]),
            'vote_button' => '<input type="' . ($row['maxVotes'] > 1 ? 'checkbox' : 'radio') . '" name="options[]" id="options-' . $i . '" value="' . $i . '" class="check" />'
        );
    }

    $return['allowed_warning'] = $row['maxVotes'] > 1 ? sprintf($txt['poll_options6'], $row['maxVotes']) : '';


    if ($return['allow_vote'])
    {
        echo '
            <form action="', $boardurl, '/SSI.php?ssi_function=pollVote" method="post" accept-charset="', $context['character_set'], '">
                <input type="hidden" name="poll" value="', $return['id'], '" />
                <table border="0" cellspacing="1" cellpadding="0">
                    <tr>
                        <td><b>', $return['question'], '</b></td>
                    </tr>
                    <tr>
                        <td>', $return['allowed_warning'], '</td>
                    </tr>';
        foreach ($return['options'] as $option)
            echo '
                    <tr>
                        <td><label for="', $option['id'], '">', $option['vote_button'], ' ', $option['option'], '</label></td>
                    </tr>';
        echo '
                    <tr>
                        <td><input type="submit" value="', $txt['ezp_built_submitvote'], '" /></td>
                    </tr>
                </table>
                <input type="hidden" name="sc" value="', $sc, '" />
            </form>';
    }
    else
    {
        echo '
                <table border="0" cellspacing="1" cellpadding="0">
                    <tr>
                        <td colspan="2"><a href="', $boardurl, '/index.php?topic=', $return['topic'], '"><small><b>', $return['question'], '</b></a></td>
                    </tr>
', $return['question'], '</b></small></td>
                    </tr>';
        foreach ($return['options'] as $option)
            echo '
                    <tr>
                        <td align="left" valign="top"><small>', $option['option'], ' (', $option['percent'], '%)</small></td>
                    </tr>
                    <tr>
                        <td align="left"><small>', $option['bar'], ' ', $option['votes'], ' </small><hr /></td>                   
                    </tr>';
        echo '
                    <tr>
                        <td colspan="2"><b>', $txt['ezp_built_totalvoters'], ': ', $return['total_votes'], '</b></td>
                    </tr>
                </table>';
    }
       
    // Html Footer
    echo $endHtml;
}

vbgamer45

Fix Change

function EzBlockPollBlock($paramters = array(), $pollTopicID, $startHtml = '', $endHtml = '')

To

function EzBlockPollBlock($paramters = array(), $pollTopicID = 0, $startHtml = '', $endHtml = '')
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Yahmez

Thanks a million vbagamer45!! You fixed my error.
Now my top posters block and my newest members blocks don't work but that's ok as long as the poll block still works. Thanks!

Magicjax

My new forum opens this coming Monday so I really need to work out the issue I've been asking for help with for last 2 weeks in this post.

Banner Rotator on page reload
First, I need my box that is centered on the top of the forum to show a different banner when the page is reloaded. Here's the script I'm trying to use:

Link to Script

Or this one:

Link to Script


Random Ordered Image Links

I have a Box on the right side of my forum with smaller Ad images. I need to make the show up in a random order.

Link to Script (With example)

These scripts require you to put a code in the HEAD section as well as the BODY of a document. I've tried all the methods I know and so far none work.

I'm willing to use any method to get the job done. I'm just hoping that I can finally get some "Support" for this. I know I'm coming across as desperate but time is running out and this needs to be worked out by this coming monday for the launch of the site.

You can see the forum in question here:
http://magictalk.com/forum/

Can someone please fill me in on how I can get these types of scripts to work in the EzPortal. It's a great mod but if I can't get this worked out I'll have to find something else.

Thanks for your time.


vbgamer45

Anything that modifies the head of the template is a theme issue and needs to be placed in the theme files in order to work.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Magicjax

Thank you very much for the reply.

I'm afraid I need a little more specific though. Which template file should I put the code in and how/where?

Thanks again for the reply.

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Magicjax

Thank you very much. I think I'm getting very close here.

In my index.template.php file I found the fallowing code that is the block that I need to apply one of the scripts to. It looks like this.


  // Show the [Advertising] button.
   echo '<li><a href="http://magictalk.com/forum/index.php?action=ezportal;sa=page;p=1"><span>Advertising</span></a></li>';


The script I need to put in the "Head" section of the html looks like this:

To go in HEAD:

<script>

/*
Random-Order content script
By JavaScript Kit (http://www.javascriptkit.com)
This notice must stay intact for use
*/

//1) Specify content(s) to display and rotate
//   You can specify multiple "sets", each displayed in diff. areas of your page

var content=new Array() //sample set 1
content[0]='<a href="http://www.dynamicdrive.com"><img src="http://www.javascriptkit.com/dynamic.gif" border=0></a>'
content[1]='<a href="http://cooltext.com"><img src="http://www.cooltext.com/images/ctb4.gif" border=0></a>'
content[2]='<a href="http://thefreesite.com"><img src="http://www.thefreesite.com/free88.gif" border=0></a>'

var diffcontent=new Array() //sample set 2
diffcontent[0]='<a href="http://www.google.com">Google Search Engine</a>'
diffcontent[1]='<a href="http://news.bbc.co.uk">BBC News</a>'
diffcontent[2]='<a href="http://www.msnbc.com">MSNBC News</a>'


function randomorder(targetarray, spacing){

var randomorder=new Array()
var the_one
var z=0
for (i=0;i<targetarray.length;i++)
randomorder[i]=i

while (z<targetarray.length){
the_one=Math.floor(Math.random()*targetarray.length)
if (targetarray[the_one]!="_selected!"){
document.write(targetarray[the_one]+spacing)
targetarray[the_one]="_selected!"
z++
}
}
}

</script>


To go in BODY:

<script>
//2) Call function randomorder(arrayname, space_between_content)
randomorder(content, '<br><br>')
randomorder(diffcontent, '<br>')
</script>


I understand the BODY part will just go in the EzBox.

But how do I put this HEAD code in the index.template.php

I'm afraid I'll need a walk through on this. I've never done this before. I now HTML pretty well but not much about PHP.

Thanks again for your help so far. I feel I'm getting warmer. LOL


Magicjax

I found a solution to my problem and I'm wondering if there is any reason I should do it this way. I just went old school and put an iFrame in the EzBlock.

Kindred

well, apart from the fact that iframes are ugly, bad process and will not maintain sessions? :)
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Magicjax

I agree. I really want to find out how to just put the javascript in the EzBlock but so far no one has been able to tell me how to do it.

I put a No border on it so no one can even tell that it is an iframe. I don't want to use this solution because I can't figure out how to put a javascript in the ezblock (This part in HEAD and this part i BODY). I can't think of anything else to do.

You can see what I did here. No one can tell it's an iFrame.
http://magictalk.com/forum/
(It's the banner on top. Reload page to see it change)

[SiNaN]

What you are trying to do can be done by PHP already.

$banners = array(
array('url_to_banner_image_1', 'url_to_site_1'),
array('url_to_banner_image_2', 'url_to_site_2'),
array('url_to_banner_image_3', 'url_to_site_3'),
);

$rand = mt_rand(0, count($banners) - 1);
echo '<a href="', $banners[$rand][1], '" target="_blank"><img src="', $banners[$rand][0], '" alt="" /></a>';
Former SMF Core Developer | My Mods | SimplePortal

Magicjax

Quote from: [SiNaN] on May 30, 2009, 02:47:42 AM
What you are trying to do can be done by PHP already.

$banners = array(
array('url_to_banner_image_1', 'url_to_site_1'),
array('url_to_banner_image_2', 'url_to_site_2'),
array('url_to_banner_image_3', 'url_to_site_3'),
);

$rand = mt_rand(0, count($banners) - 1);
echo '<a href="', $banners[$rand][1], '" target="_blank"><img src="', $banners[$rand][0], '" alt="" /></a>';


Can you elaborate on that please? Where to I put this code and what do I put in the ezblock to display it on my forum. I'm not a professional developer and I don't know much about PHP.

Thanks for any help.

Advertisement: