Jump to content

lists problem with Tempory Operators


ricky spires

Recommended Posts

Hello.

 

Im having trouble using a Tempory Operator in a list. maybe someone might know a way around it.

 

so the list below has 3 Tempory Operators.

 

the first 1 looks for pages with links that are internal links

the first 2 looks for pages with links that are external links

the first 3 looks for pages with links that have no links

 

if the link is a "nonTitle" it will be a normal list item

if the link is a "title" it will be a header for a sub list (class="subexpandable")

 

the problem is that every time it gets to the '; at the end of each Tempory Operators it breaks

 

 

 

THIS IS NOT WORKING

<ul>
	//FIND INTERNAL LINKS
	echo $type == "internal" && $list == "nonTitle" ? '<li><a href="index.php">'.$title.'</a></li>' : '<li><a href="index.php" class="subexpandable">'.$title.'</a>';


	//FIND EXTERNAL LINKS	
	echo $type == "external" && $list == "nonTitle" ? '<li><a href="http://www.url.com">'.$title.'</a></li>' : '<li><a href="http://www.url.com" class="subexpandable">'.$title.'</a>';


	//FIND NON LINKS	
	echo $type == "non" && $list == "nonTitle" ? '<li><a>'.$title.'</a></li>' : '<li><a class="subexpandable">'.$title.'</a>';


                //GET SUB LINKS
	echo'
	<ul class="subcategoryitems" style="margin-left: 15px">
                <li><a href="">sub link</a></li>
	</ul>
        </li>
</ul>';

 

 

 

 

If i put the sub level inside of each type it works but then i keep having to use the same code over.

 

 

 

THIS IS WORKING

 

<ul>
	//FIND INTERNAL LINKS
	echo $type == "internal" && $list == "nonTitle" ? '<li><a href="index.php">'.$title.'</a></li>' : '<li><a href="index.php" class="subexpandable">'.$title.'</a>
                <ul class="subcategoryitems" style="margin-left: 15px">
                <li><a href="">sub link</a></li>
	</ul>
        </li>';


	//FIND EXTERNAL LINKS	
	echo $type == "external" && $list == "nonTitle" ? '<li><a href="http://www.url.com">'.$title.'</a></li>' : '<li><a href="http://www.url.com" class="subexpandable">'.$title.'</a>
<ul class="subcategoryitems" style="margin-left: 15px">
                <li><a href="">sub link</a></li>
	</ul>
        </li>';


	//FIND NON LINKS	
	echo $type == "non" && $list == "nonTitle" ? '<li><a>'.$title.'</a></li>' : '<li><a class="subexpandable">'.$title.'</a>
<ul class="subcategoryitems" style="margin-left: 15px">
                <li><a href="">sub link</a></li>
	</ul>
        </li>';

</ul>';

 

 

 

so is there a way to do the first example without having to do the second example :)

 

 

 

thanks

ricky

Link to comment
Share on other sites

Not sure if this is going to work for you, but I'll throw it out there.

echo '<ul>'
	//FIND INTERNAL LINKS
	.($type == "internal" && $list == "nonTitle" ? '<li><a href="index.php">'.$title.'</a></li>' : '<li><a href="index.php" class="subexpandable">'.$title.'</a>').'  


	//FIND EXTERNAL LINKS	
	'.($type == "external" && $list == "nonTitle" ? '<li><a href="http://www.url.com">'.$title.'</a></li>' : '<li><a href="http://www.url.com" class="subexpandable">'.$title.'</a>').' 


	//FIND NON LINKS	
	'.($type == "non" && $list == "nonTitle" ? '<li><a>'.$title.'</a></li>' : '<li><a class="subexpandable">'.$title.'</a>').' 


                //GET SUB LINKS

	'.'<ul class="subcategoryitems" style="margin-left: 15px">
                <li><a href="">sub link</a></li>
	</ul>
        </li>
</ul>';

Link to comment
Share on other sites

Actually, this looks better.

<?php
echo '<ul>';
	//FIND INTERNAL LINKS
echo ($type == "internal" && $list == "nonTitle" ? '<li><a href="index.php">'.$title.'</a></li>' : '<li><a href="index.php" class="subexpandable">'.$title.'</a>');  


	//FIND EXTERNAL LINKS	
echo ($type == "external" && $list == "nonTitle" ? '<li><a href="http://www.url.com">'.$title.'</a></li>' : '<li><a href="http://www.url.com" class="subexpandable">'.$title.'</a>'); 


	//FIND NON LINKS	
echo ($type == "non" && $list == "nonTitle" ? '<li><a>'.$title.'</a></li>' : '<li><a class="subexpandable">'.$title.'</a>'); 


                //GET SUB LINKS

echo '<ul class="subcategoryitems" style="margin-left: 15px">
                <li><a href="">sub link</a></li>
	</ul>
        </li>
</ul>';
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.