|
Page 1 of 2
|
juggalo_master
Joined: August 2012
Posts: 35
|
Need Help Adding Link Variables
i am wanting to add my own variable so i can use my own links in the templates.
like i want to change {u_portal} to go to portal.php
and also add {u_about} to go to about.php or so on but i can't figure out where to change these settings or to add them.
i know with phpbb it would be common.php and functions.php but i can't even figure it out i found out where to add my own l_variable to the list but now i need to figure out how to change the u_ part
|
#1 Tue 04 Sep, 2012 03:15 |
|
Sponsors
|
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.
|
|
DWho
Joined: August 2006
Posts: 1307
Location: hampshire
|
Re: Need Help adding Link Variables
Links are all now situated in the default.cfg file in your default template folder..
To add a new link you need to place your code anywhere after
// LINKS - BEGIN
'U_ABOUT' => append_sid(IP_ROOT_PATH . 'about.' . PHP_EXT),
then open includes/functions.php and find
'L_PROFILE' => $lang['Profile'],
after add
'L_ABOUT' => $lang['About'],
finally open language/lang_english/lang_main.php (or your langage folder if different form english)
find
add after
and off course add the link to your overall_header.tpl in the default template or check if that file exists in the folder of any other template you are using....
obviously you can name the link whatever you like..
Hope that helps
____________ Mods and themes for Icy Phoenix 1.3
IcyPhoenix UK is off-line permanently due to lack of time to update mods.
if anyone is interested in my templates I will upgrade them to Icy 2.0.
|
#2 Tue 04 Sep, 2012 09:48 |
|
TheSteffen
Joined: August 2006
Posts: 1625
Location: Magdeburg
|
Re: Need Help adding Link Variables
Is is not easier to work with dynamic menu in CMS?
I did not test it in header, only in main links.
The advantage of this is, that everything is stored in the database, so you can not be in trouble by updating.
____________ TheSteffen
Often SEARCH is the quickest way to get support.
IcyPhoenix German Support
|
#3 Tue 04 Sep, 2012 10:31 |
|
mort
Spam Basher
Joined: August 2010
Posts: 998
Location: Up a tree
|
Re: Need Help Adding Link Variables
I was going to go this way.
Open:
default.cfg
Find:
?>
Before Add:
// My Own template variables
// START About MOD
$template->assign_vars(array(
'L_ABOUT' => $lang['About'],
'U_ABOUT' => append_sid(IP_ROOT_PATH . 'about.' . PHP_EXT),
)
);
// END About MOD
Create a file: lang_extend_my_mods.php with the script below and copy it to your language folder.
<?php
/**
*
* @package Icy Phoenix Modifications
* @File $Id: lang_extend_aboutl_mod.php
* @copyright (c)
* @license: http://opensource.org/licenses/GPL-license.php GNU Public License
*/
/**
*
* @Extra credits for this file
* Modified for Icy Phoenix by Lopalong - 31-January-2009
*
*/
if (!defined('IN_ICYPHOENIX'))
{
exit;
}
if (empty($lang) || !is_array($lang))
{
$lang = array();
}
$lang = array_merge($lang, array(
// START My Language
'ABOUT' => 'About',
// END My Language
)
);
?>
So now you have umpteen ways of doing it.
Edited by mort, Wed 05 Sep, 2012 02:19: Removed non-function script. |
#4 Tue 04 Sep, 2012 12:45 |
|
Joshua203
Joshua 203
Dutch A Go Go
Joined: August 2008
Posts: 1754
Location: Earth, Europe, the Netherlands, Rotterdam
|
Re: Need Help adding Link Variables
I've edited all topic titles in this thread guys, juggalo_master please try using topic titles that describe the question... thanks
PS.. GREAT info
____________ www.DutchaGoGo.com (development/under construction ...Forever?¿?)
|
#5 Tue 04 Sep, 2012 13:21 |
|
juggalo_master
Joined: August 2012
Posts: 35
|
Re: Need Help Adding Link Variables
thanks guys. that saved me so much aggravation and frustration i was searching through files for like atleast 2 hrs before i asked. but now i know where i can go and add my links into the functions.
|
#6 Tue 04 Sep, 2012 14:05 |
|
mort
Spam Basher
Joined: August 2010
Posts: 998
Location: Up a tree
|
Re: Need Help Adding Link Variables
I was searching through files for like at least 2 hrs.
If you had something like Notepad++ you could have done it in 10 minutes!
http://notepad-plus-plus.org/
|
#7 Tue 04 Sep, 2012 14:22 |
|
DWho
Joined: August 2006
Posts: 1307
Location: hampshire
|
Re: Need Help Adding Link Variables
Also use Windows Grep will search through folders and files for the word you place into the search function...
____________ Mods and themes for Icy Phoenix 1.3
IcyPhoenix UK is off-line permanently due to lack of time to update mods.
if anyone is interested in my templates I will upgrade them to Icy 2.0.
|
#8 Tue 04 Sep, 2012 14:59 |
|
juggalo_master
Joined: August 2012
Posts: 35
|
Re: Need Help Adding Link Variables
I was searching through files for like at least 2 hrs.
If you had something like Notepad++ you could have done it in 10 minutes!
http://notepad-plus-plus.org/
i don't like notepadd ++ it always destroy my designs.
Also use Windows Grep will search through folders and files for the word you place into the search function...
i will check that program out later.
but thanks for the support and help.
i got another question, how would i go about putting a login box into my template and having it show user details after logging in and hidding the login box?
i don't have include overall_header.tpl and footer file.
http://www.animenewsinc.net is my website i am working on
|
#9 Wed 05 Sep, 2012 05:20 |
|
mort
Spam Basher
Joined: August 2010
Posts: 998
Location: Up a tree
|
Re: Need Help Adding Link Variables
<!-- IF S_LOGGED_IN -->
Logged-in data
<!-- ELSE -->
Logged-Out data
<!-- ENDIF -->
|
#10 Wed 05 Sep, 2012 06:09 |
|
juggalo_master
Joined: August 2012
Posts: 35
|
Re: Need Help Adding Link Variables
<!-- IF S_LOGGED_IN -->
Logged-in data
<!-- ELSE -->
Logged-Out data
<!-- ENDIF -->
ok i got it to work now how would i show the user's avatar and username and log out after loggin in.
i would like to show the users details on the page after they log into the site.
|
#11 Wed 05 Sep, 2012 07:52 |
|
mort
Spam Basher
Joined: August 2010
Posts: 998
Location: Up a tree
|
Re: Need Help Adding Link Variables
Have a look at this - -
templates/default/blocks/user_block_block.tpl
It should give you more of an idea on how it works.
One problem you may run into is that NOT all variables are global, so you may have to create a new php and tpl page and redefine them.
Don't know, as I'm not sure as to what you are actually trying to do and where you are placing it.
|
#12 Wed 05 Sep, 2012 09:10 |
|
juggalo_master
Joined: August 2012
Posts: 35
|
Re: Need Help Adding Link Variables
if you look at my page and look where categories is i would be placing a log in box there for guests and for logged in users it would show there details like username, pms, avatar like it does on the forum/phpbb3 forum.
i am trying to get a log in box to work and get the user details variable for templates to work properly.
-
- <!-- IF S_LOGGED_IN -->
- <table class="empty-table" width="100%" cellspacing="0" cellpadding="0" border="0">
- <tr>
- <td align="center">
- <br />{AVATAR_IMG}<br /><br />
- <span class="name">{U_NAME_LINK}</span><br />
- <span class="gensmall">{LAST_VISIT_DATE}</span><br />
- <span class="gensmall"><a href="{U_SEARCH_NEW}">{L_NEW_SEARCH}</a></span><br /><br />
- </td>
- </tr>
- </table>
- <!-- ELSE -->
- <form method="post" action="{S_LOGIN_ACTION}">
- <table class="empty-table" width="100%" cellspacing="0" cellpadding="0" border="0">
- <tr>
- <td align="center">
- <br />
- {AVATAR_IMG}<br /><br /><span class="gensmall">
- <input type="hidden" name="redirect" value="{U_PORTAL_NOSID}" />
- {L_USERNAME}:<br />
- <input class="post" type="text" name="username" size="15" />
- <br />
- {L_PASSWORD}:<br />
- <input class="post" type="password" name="password" size="15" />
- <br />
- </span>
- <!-- BEGIN switch_allow_autologin -->
- <br />
- <input class="text" type="checkbox" name="autologin" /><span class="gensmall"> {L_REMEMBER_ME}</span><br />
- <!-- END switch_allow_autologin -->
- <br />
- <input type="submit" class="mainoption" name="login" value="{L_LOGIN}" /><br /><br />
- <a href="{U_SEND_PASSWORD}" class="gensmall">{L_SEND_PASSWORD}</a><br /><br />
- <span class="gensmall">{L_REGISTER_NEW_ACCOUNT}</span><br /><br />
- </td>
- </tr>
- </table>
- </form>
- <!-- ENDIF -->
|
#13 Wed 05 Sep, 2012 14:10 |
|
mort
Spam Basher
Joined: August 2010
Posts: 998
Location: Up a tree
|
Re: Need Help Adding Link Variables
Then you want something like this. (You will need to move things around, and add permissions and markup etc.)
<table class="empty-table" width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td align="center">
<br />{AVATAR_IMG}<br /><br />
<span class="name"> {U_NAME_LINK}</span><br />
</td>
<td>
<span class="gensmall">{LAST_VISIT_DATE}</span>
<a href="{FULL_SITE_PATH}{U_PRIVATEMSGS}">{PRIVATE_MESSAGE_INFO}</a>
<form method="post" action="{S_LOGIN_ACTION}">
<table style="width:100%; height:28px;" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="forum-buttons" align="center" valign="middle"><span class="gensmall"> <strong> Quick {L_LOGIN_LOGOUT}:</strong> </span><span class="gensmall"><strong>{L_USERNAME}: </strong>
<input class="post" type="text" name="username" size="10" /> <strong>{L_PASSWORD}: </strong>
<input class="post" type="password" name="password" size="10" maxlength="32" /> {L_AUTO_LOGIN}
<input class="text" type="checkbox" name="autologin" />
<input type="submit" class="mainoption" name="login" value=" {L_LOGIN} " />
</span>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
Open forum.php
Find:
$template->assign_vars(array(
'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts),
Before Add:
// Check For Anonymous User
if ($user->data['user_id'] != ANONYMOUS)
{
$name_link = colorize_username($user->data['user_id'], $user->data['username'], $user->data['user_color'], $user->data['user_active']);
$avatar_img = user_get_avatar($user->data['user_id'], $user->data['user_level'], $user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_allowavatar']);
}
else
{
$name_link = $lang['Guest'];
$avatar_img = '<img src="' . $config['default_avatar_guests_url'] . '" alt="" />';
}
$template->assign_vars(array(
'U_NAME_LINK' => $name_link,
)
);
Now you can see what I meant about not ALL vars are global.
I also don't know why you don't make a copy of the CMS user block with a new ID and use that with your own template file.
That's why it's a CMS!
|
#14 Thu 06 Sep, 2012 04:12 |
|
juggalo_master
Joined: August 2012
Posts: 35
|
Re: Need Help Adding Link Variables
Then you want something like this. (You will need to move things around, and add permissions and markup etc.)
<table class="empty-table" width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td align="center">
<br />{AVATAR_IMG}<br /><br />
<span class="name"> {U_NAME_LINK}</span><br />
</td>
<td>
<span class="gensmall">{LAST_VISIT_DATE}</span>
<a href="{FULL_SITE_PATH}{U_PRIVATEMSGS}">{PRIVATE_MESSAGE_INFO}</a>
<form method="post" action="{S_LOGIN_ACTION}">
<table style="width:100%; height:28px;" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="forum-buttons" align="center" valign="middle"><span class="gensmall"> <strong> Quick {L_LOGIN_LOGOUT}:</strong> </span><span class="gensmall"><strong>{L_USERNAME}: </strong>
<input class="post" type="text" name="username" size="10" /> <strong>{L_PASSWORD}: </strong>
<input class="post" type="password" name="password" size="10" maxlength="32" /> {L_AUTO_LOGIN}
<input class="text" type="checkbox" name="autologin" />
<input type="submit" class="mainoption" name="login" value=" {L_LOGIN} " />
</span>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
Open forum.php
Find:
$template->assign_vars(array(
'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts),
Before Add:
// Check For Anonymous User
if ($user->data['user_id'] != ANONYMOUS)
{
$name_link = colorize_username($user->data['user_id'], $user->data['username'], $user->data['user_color'], $user->data['user_active']);
$avatar_img = user_get_avatar($user->data['user_id'], $user->data['user_level'], $user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_allowavatar']);
}
else
{
$name_link = $lang['Guest'];
$avatar_img = '<img src="' . $config['default_avatar_guests_url'] . '" alt="" />';
}
$template->assign_vars(array(
'U_NAME_LINK' => $name_link,
)
);
Now you can see what I meant about not ALL vars are global.
I also don't know why you don't make a copy of the CMS user block with a new ID and use that with your own template file.
That's why it's a CMS!
thanks, i am not use to phpbb i am use to smf so i am still learning with phpbb and icy phoenix.
can you also show me how to get the post count and user count and total topics count for template to show up?
somewhat like this:
- Our users have posted a total of 28 articles
- Total posts 19 • Total topics 19
-
and
i know the total posts and topics is from phpbb but i want to do something similar but with icyphoenix style of posts and topics.
|
#15 Thu 06 Sep, 2012 07:24 |
|
|
Page 1 of 2
|
Was this topic useful?
Was this topic useful?
Link this topic |
URL |
|
BBCode |
|
HTML |
|
You cannot post new topics You cannot reply to topics You cannot edit your posts You cannot delete your posts You cannot vote in polls You cannot attach files You can download files You cannot post calendar events
|
|
|
|