Перейти к содержимому


Фотография
- - - - -

alphaindex

alphaindex

  • Закрытая тема Тема закрыта
Сообщений в теме: 7

#1 M Salin

M Salin

Отправлено 25 July 2014 - 19:29

hello,

 

I want to make a module that can be view when i click on a letter in the alphaindex and open to me the page example of "A" with all items. i tried to create a page calle a.html in hidden menu and than i added the modules for it but still not working like no connection with the page and the alphaindex...

any info regarding these?

 

thank you


  • 0

#2 Kess

Kess

Отправлено 26 July 2014 - 02:01

Hello,

 

So, if I understood correctly, you want different modules to appear when you filter your catalog items using alphaindex, right? Different modules attached to different letters that is. This can be achieved by making some small modifications to your Joomla template.

 

1. Open index.php of your template and add this code somewhere at the top:

$jinput = JFactory::getApplication()->input;
$alphaChar = $jinput->get('alpha_char');

2. Then find a position where you want those modules to appear and add this code there:

<?php if ($alphaChar) : ?>
    <jdoc:include type="modules" name="alpha-<?php echo $alphaChar; ?>" style="xhtml" />
<?php endif; ?>

So, when you will press one of the alphaindex links, a module position will be rendered here and its name will depend on the letter pressed. For example, if you press "a", the name of the position will be alpha-a, if you press "t" - alpha-t and so on.

 

3. Next you need to open the settings of your modules and type these positions there. So, for a module that should appear when you press "a" you must type position alpha-a. That's all.

 

gud_200x0.png


Сообщение отредактировал Kess: 26 July 2014 - 02:02

  • 0

#3 M Salin

M Salin

Отправлено 26 July 2014 - 10:11

thank you for the suggestions but it is not working... i did excatly, but should i select some pages? or should i create a page named alpha-a etc.. or just add in the module. I am using protostar and is not showing anything.

 

i did excatly what u said.

thank you


  • 0

#4 Kess

Kess

Отправлено 26 July 2014 - 11:37

If you have only one application with alphaindex, then you can set menu assignment of a module to "On all pages". There is no need to create special pages to make it work. Just set the position to alpha-a and that's all. If you have that code in the template, modules will be displayed.

If it still doesn't work, please, attach "index.php" from your template so I can check it.


  • 0

#5 M Salin

M Salin

Отправлено 26 July 2014 - 12:05

it is not working!:

<?php
    
defined('_JEXEC') or die;

$app = JFactory::getApplication();
$doc = JFactory::getDocument();
$jinput = JFactory::getApplication()->input;
    $alphaChar = $jinput->get('alpha_char');
	
// Detecting Active Variables
$option   = $app->input->getCmd('option', '');
$view     = $app->input->getCmd('view', '');
$layout   = $app->input->getCmd('layout', '');
$task     = $app->input->getCmd('task', '');
$itemid   = $app->input->getCmd('Itemid', '');
$sitename = $app->getCfg('sitename');

if($task == "edit" || $layout == "form" )
{
	$fullWidth = 1;
}
else
{
	$fullWidth = 0;
}

// Add JavaScript Frameworks
//JHtml::_('bootstrap.framework');

// Add Stylesheets
$doc->addStyleSheet('templates/'.$this->template.'/css/template.css');

// If Right-to-Left
if ($this->direction == 'rtl')
{
	$doc->addStyleSheet('templates/'.$this->template.'/css/bootstrap-rtl.css');
}

// Add current user information
$user = JFactory::getUser();

// Adjusting content width
if ($this->countModules('position-7') && $this->countModules('position-8'))
{
	$span = "span6";
}
elseif ($this->countModules('position-7') && !$this->countModules('position-8'))
{
	$span = "span9";
}
elseif (!$this->countModules('position-7') && $this->countModules('position-8'))
{
	$span = "span9";
}
else
{
	$span = "span12";
}

// Logo file
if ($this->params->get('logoFile'))
{
	$logo = JURI::root() . $this->params->get('logoFile');
}
else
{
	$logo = $this->baseurl . "/templates/" . $this->template . "/images/logo.png";
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" >
<head>
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<?php
	// Use of Google Font
	if ($this->params->get('googleFont'))
	{
	?>
		<link href='http://fonts.googleapis.com/css?family=<?php echo $this->params->get('googleFontName');?>' rel='stylesheet' type='text/css'>
	<?php
	}
	?>
	<jdoc:include type="head" />
	<?php
	// Template color
	if ($this->params->get('templateColor'))
	{
	?>
	<style type="text/css">
		body.site
		{
			border-top: 3px solid <?php echo $this->params->get('templateColor');?>;
			background-color: <?php echo $this->params->get('templateBackgroundColor');?>
		}
		a
		{
			color: <?php echo $this->params->get('templateColor');?>;
		}
		.navbar-inner, .nav-list > .active > a, .nav-list > .active > a:hover, .dropdown-menu li > a:hover, .dropdown-menu .active > a, .dropdown-menu .active > a:hover, .nav-pills > .active > a, .nav-pills > .active > a:hover
		{
			background: <?php echo $this->params->get('templateColor');?>;
		}
		.navbar-inner
		{
			-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, .25), inset 0 -1px 0 rgba(0, 0, 0, .1), inset 0 30px 10px rgba(0, 0, 0, .2);
			-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, .25), inset 0 -1px 0 rgba(0, 0, 0, .1), inset 0 30px 10px rgba(0, 0, 0, .2);
			box-shadow: 0 1px 3px rgba(0, 0, 0, .25), inset 0 -1px 0 rgba(0, 0, 0, .1), inset 0 30px 10px rgba(0, 0, 0, .2);
		}
	.c {
	text-align: center;
}
    </style>
	<?php
	}
	?>
</head>

<body class="site <?php echo $option . " view-" . $view . " layout-" . $layout . " task-" . $task . " itemid-" . $itemid . " ";?> <?php if ($this->params->get('fluidContainer')) { echo "fluid"; } ?>">

	<!-- Body -->
	<div class="body">
		<div class="container<?php if ($this->params->get('fluidContainer')) { echo "-fluid"; } ?>">
			<!-- Header -->
			<div class="header">
				<div class="header-inner">
					<a class="brand pull-left" href="<?php echo $this->baseurl; ?>">
						<img src="<?php echo $logo;?>" alt="<?php echo $sitename; ?>" />
					</a>
					<div class="header-search pull-right">
						<jdoc:include type="modules" name="position-0" style="none" />
					</div>
					<div class="clearfix"></div>
				</div>
			</div>
			<?php if ($this->countModules('position-1')): ?>
			<div class="navigation">
				<jdoc:include type="modules" name="position-1" style="none" />
			</div>
			<?php endif; ?>
			<!-- Banner -->
			<div class="banner">
				<jdoc:include type="modules" name="banner" style="xhtml" />
			</div>
			<div class="row-fluid">
				<?php if ($this->countModules('position-8')): ?>
				<!-- Begin Sidebar -->
				<div id="sidebar" class="span3">
					<div class="sidebar-nav">
						<jdoc:include type="modules" name="position-8" style="xhtml" />
					</div>
				</div>
				<!-- End Sidebar -->
				<?php endif; ?>
				<div id="content" class="<?php echo $span;?>">
					<!-- Begin Content -->
					<jdoc:include type="modules" name="position-3" style="xhtml" />
					<jdoc:include type="message" />
					<jdoc:include type="component" />
					<jdoc:include type="modules" name="position-2" style="none" />
					<!-- End Content -->
				</div>
				<?php if ($this->countModules('position-7')) : ?>
				<div id="aside" class="span3">
					<!-- Begin Right Sidebar -->
					       
                  <jdoc:include type="modules" name="position-7" style="well" />
                    <?php if ($alphaChar) : ?>
    <jdoc:include type="modules" name="alpha-<?php echo $alphaChar; ?>" style="xhtml" />
    <?php endif; ?>              
                    
				  <!-- End Right Sidebar -->
				</div>
				<?php endif; ?>
			</div>
		</div>
	</div>
	<!-- Footer -->
	<div class="footer">
		<div class="container<?php if ($this->params->get('fluidContainer')) { echo "-fluid"; } ?>">
			<hr />
			<jdoc:include type="modules" name="footer" style="none" />
			<p class="pull-right"><a href="#top" id="back-top">Back to top</a></p>
			<p>&copy; <?php echo $sitename; ?> <?php echo date('Y');?></p>
		</div>
	</div>
	<jdoc:include type="modules" name="debug" style="none" />
	
	<script src="<?php echo $this->baseurl ;?>/templates/<?php echo $this->template ;?>/js/jquery.js"></script>
	<script src="<?php echo $this->baseurl ;?>/templates/<?php echo $this->template ;?>/js/google-code-prettify/prettify.js"></script>
	<script src="<?php echo $this->baseurl ;?>/templates/<?php echo $this->template ;?>/js/bootstrap-transition.js"></script>
	<script src="<?php echo $this->baseurl ;?>/templates/<?php echo $this->template ;?>/js/bootstrap-alert.js"></script>
	<script src="<?php echo $this->baseurl ;?>/templates/<?php echo $this->template ;?>/js/bootstrap-modal.js"></script>
	<script src="<?php echo $this->baseurl ;?>/templates/<?php echo $this->template ;?>/js/bootstrap-dropdown.js"></script>
	<script src="<?php echo $this->baseurl ;?>/templates/<?php echo $this->template ;?>/js/bootstrap-scrollspy.js"></script>
	<script src="<?php echo $this->baseurl ;?>/templates/<?php echo $this->template ;?>/js/bootstrap-tab.js"></script>
	<script src="<?php echo $this->baseurl ;?>/templates/<?php echo $this->template ;?>/js/bootstrap-tooltip.js"></script>
	<script src="<?php echo $this->baseurl ;?>/templates/<?php echo $this->template ;?>/js/bootstrap-popover.js"></script>
	<script src="<?php echo $this->baseurl ;?>/templates/<?php echo $this->template ;?>/js/bootstrap-button.js"></script>
	<script src="<?php echo $this->baseurl ;?>/templates/<?php echo $this->template ;?>/js/bootstrap-collapse.js"></script>
	<script src="<?php echo $this->baseurl ;?>/templates/<?php echo $this->template ;?>/js/bootstrap-carousel.js"></script>
	<script src="<?php echo $this->baseurl ;?>/templates/<?php echo $this->template ;?>/js/bootstrap-typeahead.js"></script>
	<script src="<?php echo $this->baseurl ;?>/templates/<?php echo $this->template ;?>/js/application.js"></script>
<script type="text/javascript">
        jQuery.noConflict();
</script>
	<script>
		jQuery('*[rel=tooltip]').tooltip()
		jQuery('*[rel=popover]').popover()
		jQuery('.tip-bottom').tooltip({placement: "bottom"})
	</script>
</body>
</html>


maybe must be done something in the xml file? because there no positions... or nothing to have with it? (blush)


  • 0

#6 Sliapy

Sliapy

Отправлено 26 July 2014 - 13:29

You don't need to choose position. You can inscribe in you own postition just like Kess said (alpha-a, for example).


Сообщение отредактировал Sliapy: 26 July 2014 - 13:29

  • 0
[color=#aa0000]Не забывайте нажимать кнопку "Вопрос Решён" под сообщением, которое решило Вашу проблему.[/color]

#7 M Salin

M Salin

Отправлено 26 July 2014 - 13:55

yes i did but doesn't work... :(

i sent also the code to check


  • 0

#8 Kess

Kess

Отправлено 28 July 2014 - 05:30

Maybe that's because you inserted that code in another condition:

<?php if ($this->countModules('position-7')) : ?> 

 so if you don't have any modules in "position-7", alpha modules will not be displayed.

 

Just try to move this code:

<?php if ($alphaChar) : ?>
<jdoc:include type="modules" name="alpha-<?php echo $alphaChar; ?>" style="xhtml" />
<?php endif; ?>

outside any other conditions.

 

Or change that template condition to

<?php if ($this->countModules('position-7') || $alphaChar) : ?>

Сообщение отредактировал Kess: 28 July 2014 - 05:41

  • 0





Темы с аналогичным тегами alphaindex

Click to return to top of page in style!