if else ???

tokenring 23 Jun, 2009
I have this plugin installed on my site, made a few changes and I need some help on understanding one more key area of the plugin. I can't exactly tell what condition has to be met here in order for the plugin to work on ALL articles in the PROFILES (section) but I'm almost there.

plugin
<?php /* $Id: articles_default.php 3 2008-07-07 22:00:38Z pentacle $ */
defined('_JEXEC') or die('Restricted access'); ?>

<?php
// Remove this PHP code block if you don't want the list to be collapsible
$js = "
window.addEvent('domready', function() {
	var articles = new Fx.Slide('otherarticles').hide();

	$('toggleothers').addEvent('click', function(e) {
		e = new Event(e);
		articles.toggle();
		e.stop();
	});
});";
JHTML::_('behavior.mootools');
$document =& JFactory::getDocument();
$document->addScriptDeclaration($js);
?>

<p id="toggleothers"><a href="">Click here</a></p>

// need help from here on
<?php if (empty($article->created_by_alias)):
	$user = JFactory::getUser($article->created_by); ?>
<p><strong><?php echo $user->get('name') ?></strong> has been with us since <?php echo JHTML::_('date', $user->get('registerDate')); ?>.</p>
<?php else: ?>
<strong>to see <?php echo $article->created_by_alias; ?>'s other Mixes</strong>
<?php endif; ?>

<ul id="otherarticles">
<?php foreach ( $links as $link ): ?>
	<li><a href="<?php echo $link->href; ?>" title="<?php echo $link->title; ?>"><?php echo $link->title; ?></a>
	<?php if ($this->params->get('showdate', 1)) { ?>(<?php echo $link->date ?>)<?php } ?>
	</li>
<?php endforeach; ?>
</ul>
so I commented the part that I think I need help on. Here is the situation. I have articles that are in a SECTION called "DJ profiles" and they have an author, and an author_alias ( which = created_by and Created_by_alias respectively). I also have articles in a "mixes" SECTION which have the same 2 attributes set.

In the plugin manager I have this plugin set to only pull articles from the "mixes" SECTION and have the plugin to only display the results of that in the "profiles" SECTION.

However, the list that this plugin shows is only showing up in "Profiles" where

created_by = created_by_alias.

I've tried a bunch of ways in this file to resolve that and I can't. I know this is what it is because when i modify another user that has those not equaling each other to match, then the list shows up for them.

so if you go to my site and check the section called DJ Profiles, there will be about 15 records. If you click on a record that has the created_by = created_by_alias, this page will have the list below, if they don't match, the list won't exist.

Thanks,

Aaron
tokenring 07 Jul, 2009
does anyone have an idea?
GreyHead 07 Jul, 2009
Hi Aaron,

I don't see any code in there that is selecting articles to display. Is there another chunk somewhere?

Bob
tokenring 08 Jul, 2009
Am I making sense though? Do you see the symptom of what is happening? I just want to make sure that all understands what is happening...

what about this code?


ul id="otherarticles">
<?php foreach ( $links as $link ): ?>
<li><a href="<?php echo $link->href; ?>" title="<?php echo $link->title; ?>"><?php echo $link->title; ?></a>
<?php if ($this->params->get('showdate', 1)) { ?>(<?php echo $link->date ?>)<?php } ?>
</li>
<?php endforeach; ?>


I can't find any other code for this plugin at all. It seems that it checks the created_by and created_by_alias and if they are the same, it displays them.
tokenring 09 Jul, 2009
sorry...

i'm now not sure what the condition has to be in order for the plugin to appear in the articles. I've been toggling the author, title and author_alias and whenever the "author_alias" container equals what is set for "created_by_alias;" in the lines below, the plugin is displayed.

<?php else: ?>
<strong>to see <?php echo $article->created_by_alias; ?>'s other Mixes</strong>
<?php endif; ?>


aaron
tokenring 09 Jul, 2009
okay... so I think I know why it isn't working. The "Created_by_alias" has to be of the of a certain string (matching the created_by_alias) of the articles that I want in the plugin list.

So what I need to know is:

can I somehow ask the user for either the "Title" or "Created_by_alias" and have that applied to both??? I only want to ask them one time, but I want both containers to be filled with the same value.


Aaron
This topic is locked and no more replies can be posted.