Need Help Adding Link Variables »  Show posts from    to     

Icy Phoenix


Old Styles Topics - Need Help Adding Link Variables



juggalo_master [ Tue 04 Sep, 2012 03:15 ]
Post subject: 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


DWho [ Tue 04 Sep, 2012 09:48 ]
Post subject: 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

Code: [Hide] [Select]
'U_ABOUT' => append_sid(IP_ROOT_PATH . 'about.' . PHP_EXT),


then open includes/functions.php and find

Code: [Hide] [Select]
'L_PROFILE' => $lang['Profile'],


after add

Code: [Hide] [Select]
'L_ABOUT' => $lang['About'],


finally open language/lang_english/lang_main.php (or your langage folder if different form english)

find

Code: [Hide] [Select]
'Profile' => 'Profile',


add after

Code: [Hide] [Select]
'About' => 'About',


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



TheSteffen [ Tue 04 Sep, 2012 10:31 ]
Post subject: 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.


mort [ Tue 04 Sep, 2012 12:45 ]
Post subject: Re: Need Help Adding Link Variables
I was going to go this way.

Open:

default.cfg

Find:

?>

Before Add:

Code: [Hide] [Select]
// 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.


Code: [Hide] [Select]
<?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.


Joshua203 [ Tue 04 Sep, 2012 13:21 ]
Post subject: Re: Need Help adding Link Variables
 
Off Topic
:
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


juggalo_master [ Tue 04 Sep, 2012 14:05 ]
Post subject: 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.


mort [ Tue 04 Sep, 2012 14:22 ]
Post subject: Re: Need Help Adding Link Variables
juggalo_master wrote: [View Post]
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/



DWho [ Tue 04 Sep, 2012 14:59 ]
Post subject: 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...



juggalo_master [ Wed 05 Sep, 2012 05:20 ]
Post subject: Re: Need Help Adding Link Variables
mort wrote: [View Post]
juggalo_master wrote: [View Post]
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.

DWho wrote: [View Post]
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


mort [ Wed 05 Sep, 2012 06:09 ]
Post subject: Re: Need Help Adding Link Variables
<!-- IF S_LOGGED_IN -->

Logged-in data

<!-- ELSE -->

Logged-Out data

<!-- ENDIF -->


juggalo_master [ Wed 05 Sep, 2012 07:52 ]
Post subject: Re: Need Help Adding Link Variables
mort wrote: [View Post]
<!-- 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.


mort [ Wed 05 Sep, 2012 09:10 ]
Post subject: 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.


juggalo_master [ Wed 05 Sep, 2012 14:10 ]
Post subject: 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.
Code: [Hide]
  1.  
  2. <!-- IF S_LOGGED_IN --> 
  3. <table class="empty-table" width="100%" cellspacing="0" cellpadding="0" border="0"> 
  4. <tr> 
  5. <td align="center"> 
  6. <br />{AVATAR_IMG}<br /><br /> 
  7. <span class="name">{U_NAME_LINK}</span><br /> 
  8. <span class="gensmall">{LAST_VISIT_DATE}</span><br /> 
  9. <span class="gensmall"><a href="{U_SEARCH_NEW}">{L_NEW_SEARCH}</a></span><br /><br /> 
  10. </td> 
  11. </tr> 
  12. </table> 
  13. <!-- ELSE --> 
  14. <form method="post" action="{S_LOGIN_ACTION}"> 
  15. <table class="empty-table" width="100%" cellspacing="0" cellpadding="0" border="0"> 
  16. <tr> 
  17. <td align="center"> 
  18. <br /> 
  19. {AVATAR_IMG}<br /><br /><span class="gensmall"> 
  20. <input type="hidden" name="redirect" value="{U_PORTAL_NOSID}" /> 
  21. {L_USERNAME}:<br /> 
  22. <input class="post" type="text" name="username" size="15" /> 
  23. <br /> 
  24. {L_PASSWORD}:<br /> 
  25. <input class="post" type="password" name="password" size="15" /> 
  26. <br /> 
  27. </span> 
  28. <!-- BEGIN switch_allow_autologin --> 
  29. <br /> 
  30. <input class="text" type="checkbox" name="autologin" /><span class="gensmall">&nbsp;{L_REMEMBER_ME}</span><br /> 
  31. <!-- END switch_allow_autologin --> 
  32. <br /> 
  33. <input type="submit" class="mainoption" name="login" value="{L_LOGIN}" /><br /><br /> 
  34. <a href="{U_SEND_PASSWORD}" class="gensmall">{L_SEND_PASSWORD}</a><br /><br /> 
  35. <span class="gensmall">{L_REGISTER_NEW_ACCOUNT}</span><br /><br /> 
  36. </td> 
  37. </tr> 
  38. </table> 
  39. </form> 
  40. <!-- ENDIF --> 


mort [ Thu 06 Sep, 2012 04:12 ]
Post subject: 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.)

Spoiler: [ Show ]


Open forum.php
Spoiler: [ Show ]


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!


juggalo_master [ Thu 06 Sep, 2012 07:24 ]
Post subject: Re: Need Help Adding Link Variables
mort wrote: [View Post]
Then you want something like this. (You will need to move things around, and add permissions and markup etc.)

Spoiler: [ Show ]


Open forum.php
Spoiler: [ Show ]


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:

Code: [Hide]
  1. Our users have posted a total of 28 articles 
  2. Total posts 19 • Total topics 19 
  3.  

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.


mort [ Thu 06 Sep, 2012 08:04 ]
Post subject: Re: Need Help Adding Link Variables
You had better get used to looking and learning how to use the CMS, as the details you are after are in here.

/blocks/statistics.php

And please, stop quoting the post above yours (Or the last post), especially when they contain a lot of detail. Use the "Reply" button instead.

Why?

Because I have to go through all this in my quick-view mail-washer just to read your few lines at the bottom.....

Spoiler: [ Show ]


That's why!


juggalo_master [ Thu 06 Sep, 2012 14:28 ]
Post subject: Re: Need Help Adding Link Variables
oh ok. i will look and see if i can find what i am looking for.

should really have a tutorial for new users on how to use the system specially for 2.0.

i have copied this
Code: [Hide]
  1. 'TOTAL_USERS' => sprintf($l_total_user_s, $total_users), 
  2. 'NEWEST_USER' => sprintf($lang['Newest_user'], '', $newest_user, ''), 
  3. 'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts), 
  4. 'TOTAL_TOPICS' => sprintf($lang['total_topics'], $total_topics), 
  5. in the tpl file: 
  6. <table class="empty-table" width="100%" cellspacing="0" cellpadding="0" border="0"> 
  7. <tr><td><span class="gensmall">{TOTAL_USERS}<br />{NEWEST_USER}<br /><br />{TOTAL_POSTS} {TOTAL_TOPICS}</span></td></tr> 
  8. </table> 
  9.  
  10.  
  11.  
into my php file and it still doesn't show up the posts and topics.

is there something else i need?


mort [ Thu 06 Sep, 2012 23:28 ]
Post subject: Re: Need Help Adding Link Variables
You would possibly need to copy the SQL that queries the information for that data to your php file also.

And you're right about the docs, but I don't think anyone has had the chance to catch up.


juggalo_master [ Fri 07 Sep, 2012 03:45 ]
Post subject: Re: Need Help Adding Link Variables
oh ok. couldn't i had a specific tag to show the information without using php or no?


mort [ Fri 07 Sep, 2012 08:38 ]
Post subject: Re: Need Help Adding Link Variables
No,

You need to have a function that queries the database for the info, then you have to add vars to the queries, then you need to pass those vars to the template like this for example.

Code: [Hide] [Select]
$template->assign_vars(array(
'TOTAL_USERS' => sprintf($l_total_user_s, $total_users),
'NEWEST_USER' => sprintf($lang['Newest_user'], '', $newest_user, ''),
'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts),
'TOTAL_TOPICS' => sprintf($lang['total_topics'], $total_topics),
)
);


Then in your template you would have {TOTAL_USERS} to pass the $total_users query to the front-end etc.

Welcome to phpBB code?

And by the way, it's not something I bother with much any more (since Icy Phoenix has changed so dramatically from the last version and I don't want you to think I'm ignoring you), so you'll have to wait for an Icy Phoenix fanatic to assist you further.


juggalo_master [ Fri 07 Sep, 2012 23:57 ]
Post subject: Re: Need Help Adding Link Variables
i did that it didn't work the way i was hoping but i guess i will have to figure it out somehow. if i can take it from phpbb3 template and show it on icy i might be able to figure it out. i am guessing 2.0 just came out.


mort [ Sat 08 Sep, 2012 01:48 ]
Post subject: Re: Need Help Adding Link Variables
Yes, Version 2.* has just been released and is more or less still undergoing beta testing.

I may have given you a bum steer too.

Try this:

Open:

templates/default/default.cfg

Find:

?>

Before add:

Code: [Hide] [Select]
$template->assign_vars(array(
'TOTAL_USERS' => sprintf($l_total_user_s, $total_users),
'NEWEST_USER' => sprintf($lang['Newest_user'], '', $newest_user, ''),
'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts),
'TOTAL_TOPICS' => sprintf($lang['total_topics'], $total_topics),
)
);


Template code:

{TOTAL_USERS} {NEWEST_USER} {TOTAL_POSTS} {TOTAL_TOPICS}


juggalo_master [ Sat 08 Sep, 2012 03:49 ]
Post subject: Re: Need Help Adding Link Variables
i get this:

The newest registered user is within topics

this is all that shows nothing else when i use those codes. i tried the way you just mentioned.

how would i go about doing it from a older version maybe i be able to get it to work that way by looking at the old way from the older versions and then convert it to 2.0.


mort [ Sat 08 Sep, 2012 04:26 ]
Post subject: Re: Need Help Adding Link Variables
It's all showing up for me?

Do us a favour,

Take a snapshot of your forum where you want to add this and add a sketch of what you are actually trying to do with all the details you want in it.

Because at the moment it's like working in the dark as some vars, as I explained before - don't work in all locations.


juggalo_master [ Sat 08 Sep, 2012 08:06 ]
Post subject: Re: Need Help Adding Link Variables
jugg i am mostly wanting it to show up right in this block.

i want to add the total posts, users, and topics on that section.

btw the 1.4 million, 21, and 18 isn't my posts. i just started up this script like a few days ago.

those arent the stats of the forum.


mort [ Sat 08 Sep, 2012 08:26 ]
Post subject: Re: Need Help Adding Link Variables
I'm no expert, but I just wasted far too much time trying to work out how IP is now put together.

phpBB3 is something that never interested me (which is the way IP is going), and learning it is something I never wanted to get involved with - - So I'm out of it.



Mighty Gorgon [ Sun 09 Sep, 2012 18:48 ]
Post subject: Re: Need Help Adding Link Variables
Those informations are added to CACHE to avoid excessive MySQL charge.

Here is how you can recall them:

Code: [Hide] [Select]
if (empty($config['max_topics']) || empty($config['max_posts']) || empty($config['max_users']) || empty($config['last_user_id']))
{
board_stats();
}
$total_topics = $config['max_topics'];
$total_posts = $config['max_posts'];
$total_users = $config['max_users'];
$newest_user = $cache->obtain_newest_user();


Remember that you may need to add at least global $db, $cache, $config; if you plan to use those info within a function.


juggalo_master [ Sun 09 Sep, 2012 21:13 ]
Post subject: Re: Need Help Adding Link Variables
thanks mg i was trying to figure out was how to do that. now maybe i be able to figure out how to do other things as well.




Powered by Icy Phoenix