Eminem Posted March 21, 2007 Share Posted March 21, 2007 $txt['profile_show_pets'] What does this mean? I see it in an SMF forum's .php file? How can I create a Hyperlink using "$txt"? Like this?: <a href="', $scripturl, '?action=profile;u=', $context['member']['id'], ';sa=showPets">', $txt['profile_show_pets'], '.</a><br /> Link to comment https://forums.phpfreaks.com/topic/43735-little-question/ Share on other sites More sharing options...
per1os Posted March 21, 2007 Share Posted March 21, 2007 Your code does not work? seems like it should, I am not sure on the , (commas) I usually use . (periods) anyhow, looking at that it does not work? $txt is an array and profile_show_pets is an index of the array $txt, so when calling the $txt['profile_show_pets'] it displays what is in the array at index profile_show_pets. Link to comment https://forums.phpfreaks.com/topic/43735-little-question/#findComment-212329 Share on other sites More sharing options...
The Little Guy Posted March 21, 2007 Share Posted March 21, 2007 $txt <-- This is the variable to an array ['profile_show_kitten'] <-- This is the object within the array <?php $txt = array('profile_show_kitten' => 'Kitten','profile_show_cat' => 'Cat','profile_show_dog' => 'Dog'); ?> SO... if profile_show_kitten is equal to Kitten like above and you do this: <?php echo $txt['profile_show_kitten']; ?> Your output will be Kitten Link to comment https://forums.phpfreaks.com/topic/43735-little-question/#findComment-212330 Share on other sites More sharing options...
Eminem Posted March 21, 2007 Author Share Posted March 21, 2007 $txt <-- This is the variable to an array ['profile_show_kitten'] <-- This is the object within the array <?php $txt = array('profile_show_kitten' => 'Kitten','profile_show_cat' => 'Cat','profile_show_dog' => 'Dog'); ?> SO... if profile_show_kitten is equal to Kitten like above and you do this: <?php echo $txt['profile_show_kitten']; ?> Your output will be Kitten It ends up being just a period as the link. I was a hyperlink that will still link to where it does. Let's say that $txt['profile_show_pets'] shows "Show this member's Pets. I want to make it so it says "Show this person's animal. I want to change the hyperlink text. Link to comment https://forums.phpfreaks.com/topic/43735-little-question/#findComment-212337 Share on other sites More sharing options...
per1os Posted March 21, 2007 Share Posted March 21, 2007 $txt['profile_show_pets'] = "Show this person's animal."; Link to comment https://forums.phpfreaks.com/topic/43735-little-question/#findComment-212339 Share on other sites More sharing options...
The Little Guy Posted March 21, 2007 Share Posted March 21, 2007 Something like this? <?php $txt = array('profile_show_kitten' => 'Kitten'); foreach($txt as $key => $val){ echo'<a href="link_to_page.php?page='.$key.'">'.$val.'</a>'; } ?> Link to comment https://forums.phpfreaks.com/topic/43735-little-question/#findComment-212345 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.