TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,004
  • Total Topics: 21,330
  • Online today: 219
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 139
  • Total: 139

Did I code this home link correct?

Started by ApplianceJunk, January 06, 2008, 10:46:13 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ApplianceJunk

I added a home link to the TP userbox on our site.

I took bits and pieces of code from other places and come up with this.

// Edit Home... [home]
if ($context['user']['is_logged'])
echo'<br />'.$bullet.'<a href="', $scripturl, '?action=index.php">' , $txt['tp-home'] , '</a>';


It seems to work ok, but the part I am not sure about is the ?action=index.php
Is that correct?

I am still trying to build on what I learned from IchBin in this topic.
http://www.tinyportal.net/index.php?topic=21084.0

Guess we will need this info too so I stay with in the posting guide lines.

1. If you have a URL, please post it.

http://www.ApplianceJunk.com

2. If you are getting an error message, copy it and paste it into your post. You can delete any privacy info, like usernames, etc., but try to keep as much of the error message intact as possible.

We are not getting any error messages at this time.


3. Let us know what version(s) you are using.
       
SMF 1.1.4/TinyPortal v0.9.8


4. Do you have any mods installed? If yes, tell us.

We have these mods installed.

1. SMF 1.1.2 Update Package 1.1.2
2. SMF 1.0.11 / 1.1.3 Update 1.1 
3. Ad Managment 2.3
4. Streaming 3 4.2.2b
5. nwsw.nwswAdminAttachAnything 1.1 RC3
6. SMF Sitemap 1.2.1
7. Users Online Today Mod 1.4.0
8. SMF Arcade 2.0.11
9. URL Popup 1.0
10. SMF Trader System 1.1 
11. SMF Classifieds Recent Classifieds Board Index 1.0 
12. TinyPortal 0.983 
13. SMF Gallery Pro 1.3beta3 
14. SMF Gallery Pro Upgrade 1.3
15. SMF 1.0.12 / 1.1.4 / 2.0 b1.1 Update 1.0 
16. Internal Links Use Same Window 1.1 
17. SMF Classifieds 1.1
18. Social Bookmarks 1.1
19. SSI Topic and Replies 0.1 
20. SMFBlog 0.1 Beta 
21. Treasury 2.04
22. Topic description 1.1

G6Cad

the index.php is not an action, if you want the button to point to the home directory ( start page) you will have to put in the direct url instead of the action=

ApplianceJunk

You mean like this?

// Edit Home... [home]
if ($context['user']['is_logged'])
echo'<br />'.$bullet.'<a href="http://www.appliancejunk.com/forums/">' , $txt['tp-home'] , '</a>';

Hairy

More like this:

// Edit Home... [home]
if ($context['user']['is_logged'])
echo'<br />'.$bullet.'<a href="', $scripturl, '">' , $txt['tp-home'] , '</a>';


You almost had it in the first place, just didn't need the ?action=index.php in the code

ApplianceJunk

I have it like this now and its working.

// Edit Home... [home]
if ($context['user']['is_logged'])
echo'<br />'.$bullet.'<a href="', $scripturl, '">' , $txt['tp-home'] , '</a>';


It also seem to work when I had it the other way's too, but I wanted to make sure I did it the correct way.

thanks,

Hairy

Sorry shoulda explained better  :)

// Edit Home... [home]
if ($context['user']['is_logged'])
echo'<br />'.$bullet.'<a href="', $scripturl, '?action=index.php">' , $txt['tp-home'] , '</a>';


This was incorrect but because ?action=index.php is an invalid destination, the forum defaults to the home directory if an invalid link is used which by chance was the directory you were after, only problem is this code might start filling up your error log.



Quote from: ApplianceJunk on January 06, 2008, 11:52:31 PM
You mean like this?

// Edit Home... [home]
if ($context['user']['is_logged'])
echo'<br />'.$bullet.'<a href="http://www.appliancejunk.com/forums/">' , $txt['tp-home'] , '</a>';


This one is fine to use at the moment but if you ever change directory of your forum then you will have to edit this again



Quote from: ApplianceJunk on January 07, 2008, 12:17:52 AM
I have it like this now and its working.

// Edit Home... [home]
if ($context['user']['is_logged'])
echo'<br />'.$bullet.'<a href="', $scripturl, '">' , $txt['tp-home'] , '</a>';


It also seem to work when I had it the other way's too, but I wanted to make sure I did it the correct way.

thanks,

This is the best code to use, no need to edit if you ever change domains/directories  :up:


Cheers  :coolsmiley:

ApplianceJunk


This website is proudly hosted on Crocweb Cloud Website Hosting.