vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Add prefix in code? (https://vborg.vbsupport.ru/showthread.php?t=209889)

MarkFoster 03-30-2009 05:26 PM

Add prefix in code?
 
1 Attachment(s)
I have a code that grabs information from threads for a box on my portal, but it Can't grab prefixes which would be pretty important.

Could sombdy edit this code for me so it will include thread prefixes:
Code:

<a href="$vboptions[bburl]/news.php?id=$thread[threadid]" $thread[prefix_plain_html] title="$thread[title]"><strong>$thread[title]</strong></a><br />
$dateposted<br />
Posted by <strong><a href="$vboptions[bburl]/member.php?u=$thread[postuserid]">$thread[postusername]</a></strong><br />
<font size="2" face="Times" color="#383838">
        $message
</font>
<br /><br />

Look in attachments what it's for.

Lynne 03-30-2009 05:29 PM

You need to have grabbed the prefixid in your query for the threads. Then in the php (your plugin or page code):
PHP Code:

if ($latestthread['prefixid']) 

$latestthread['prefix_plain_html'] = htmlspecialchars_uni($vbphrase["prefix_$latestthread[prefixid]_title_plain"]); 
$latestthread['prefix_rich'] = $vbphrase["prefix_$latestthread[prefixid]_title_rich"]; 

else 

$latestthread['prefix_plain_html'] = ''
$latestthread['prefix_rich'] = ''


And you can use one of those in your template.

MarkFoster 03-30-2009 05:40 PM

Quote:

Originally Posted by Lynne (Post 1780516)
You need to have grabbed the prefixid in your query for the threads. Then in the php (your plugin or page code):
PHP Code:

if ($latestthread['prefixid']) 

$latestthread['prefix_plain_html'] = htmlspecialchars_uni($vbphrase["prefix_$latestthread[prefixid]_title_plain"]); 
$latestthread['prefix_rich'] = $vbphrase["prefix_$latestthread[prefixid]_title_rich"]; 

else 

$latestthread['prefix_plain_html'] = ''
$latestthread['prefix_rich'] = ''


And you can use one of those in your template.

Thanks for helping out but I don't know what I should do with the code :/
I don't know how to do a query and it's actually a template.

Lynne 03-30-2009 05:52 PM

It could already be available for use - I don't know. You have this in the middle of your template that you posted above:
HTML Code:

$thread[prefix_plain_html]
It's just sitting in the <a> tag which is weird and won't have it show in front of the thread title. If you want it to show, you need to have it outside of the middle of the <a> tag.

MarkFoster 03-30-2009 05:57 PM

Quote:

Originally Posted by Lynne (Post 1780538)
It could already be available for use - I don't know. You have this in the middle of your template that you posted above:
HTML Code:

$thread[prefix_plain_html]
It's just sitting in the <a> tag which is weird and won't have it show in front of the thread title. If you want it to show, you need to have it outside of the middle of the <a> tag.

No it didn't work, I added that part to the code before I posted this, apprently nothing works so I need some code for it.

Lynne 03-30-2009 06:01 PM

But your code in post one is wrong. It's not going to show a thing.

MarkFoster 03-30-2009 06:03 PM

Quote:

Originally Posted by Lynne (Post 1780549)
But your code in post one is wrong. It's not going to show a thing.

This is the original code:
Code:

<a href="$vboptions[bburl]/news.php?id=$thread[threadid]" title="$thread[title]"><strong>$thread[title]</strong></a><br />
$dateposted<br />
Posted by <strong><a href="$vboptions[bburl]/member.php?u=$thread[postuserid]">$thread[postusername]</a></strong><br />
<font size="2" face="Times" color="#383838">
        $message
</font>
<br /><br />

Coudl you edit it for me to get it working with prefixes?

Lynne 03-30-2009 06:17 PM

If it's available for use, it should show up with this code:
Code:

$thread[prefix_plain_html] <a href="$vboptions[bburl]/news.php?id=$thread[threadid]" title="$thread[title]"><strong>$thread[title]</strong></a><br />
$dateposted<br />
Posted by <strong><a href="$vboptions[bburl]/member.php?u=$thread[postuserid]">$thread[postusername]</a></strong><br />
<font size="2" face="Times" color="#383838">
    $message
</font>
<br /><br />

If that doesn't work, then you will have to ask for help in the modification thread for help modifying the query for the threads.

MarkFoster 03-30-2009 06:43 PM

Quote:

Originally Posted by Lynne (Post 1780562)
If it's available for use, it should show up with this code:
Code:

$thread[prefix_plain_html] <a href="$vboptions[bburl]/news.php?id=$thread[threadid]" title="$thread[title]"><strong>$thread[title]</strong></a><br />
$dateposted<br />
Posted by <strong><a href="$vboptions[bburl]/member.php?u=$thread[postuserid]">$thread[postusername]</a></strong><br />
<font size="2" face="Times" color="#383838">
    $message
</font>
<br /><br />

If that doesn't work, then you will have to ask for help in the modification thread for help modifying the query for the threads.

Didn't work :/
What about the first code you posted, can I use that for anything?

There really isn't a modification released for it because I payed fore it and the creator isn't around anymore.
Any way a XML could be edited for this?

Lynne 03-30-2009 06:48 PM

The code I posted is what I use in a modification I have for my site. I had to modify the query that grabs the threads and add the prefixid to the field list and then use that code to 'create' the prefix to be used in the template. You can probably edit your modification to do all this. Play with it on your test site - that's the best thing to do when you need to figure things out.

MarkFoster 03-30-2009 07:04 PM

1 Attachment(s)
Well, if anybody could take a look I have the files in the attachments.

Lynne 03-30-2009 09:15 PM

Try adding thread.prefixid to the two queries in the news.php page. And then just add this under there:

PHP Code:

if ($latestthread['prefixid']) 

$thread['prefix_plain_html'] = htmlspecialchars_uni($vbphrase["prefix_$thread[prefixid]_title_plain"]); 
$thread['prefix_rich'] = $vbphrase["prefix_$thread[prefixid]_title_rich"]; 

else 

$thread['prefix_plain_html'] = ''
$thread['prefix_rich'] = ''


Put it under the lines about the iconpath but above the template eval statement.

MarkFoster 03-30-2009 09:22 PM

Quote:

Originally Posted by Lynne (Post 1780678)
Try adding thread.prefixid to the two queries in the news.php page. And then just add this under there:

PHP Code:

if ($latestthread['prefixid']) 

$thread['prefix_plain_html'] = htmlspecialchars_uni($vbphrase["prefix_$thread[prefixid]_title_plain"]); 
$thread['prefix_rich'] = $vbphrase["prefix_$thread[prefixid]_title_rich"]; 

else 

$thread['prefix_plain_html'] = ''
$thread['prefix_rich'] = ''


Put it under the lines about the iconpath but above the template eval statement.

I honestly have no idea what your talking about, would you be able to alter it and post the full code here?

Lynne 03-30-2009 09:47 PM

Is this a mod you purchased that you have exclusive rights to and can do what you want with (like posting it here)?

What about my directions don't make sense? I mean, I would like to be able to write stuff that people can understand and would love to know where I'm going wrong.

MarkFoster 03-30-2009 10:18 PM

Quote:

Originally Posted by Lynne (Post 1780694)
Is this a mod you purchased that you have exclusive rights to and can do what you want with (like posting it here)?

What about my directions don't make sense? I mean, I would like to be able to write stuff that people can understand and would love to know where I'm going wrong.

Yes I own the mod and have rights to do what I want with it.

Sorry about that, well I just don't have much of experience with it...

Lynne 03-30-2009 10:31 PM

1 Attachment(s)
OK, I just had to make sure. I was suggesting the changes in the news.php file I've attached along with the change to the template posted above. Of course, I haven't tested it at all, so try it on your test site first. If you get an error, post the exact message.

MarkFoster 03-30-2009 11:05 PM

Quote:

Originally Posted by Lynne (Post 1780709)
OK, I just had to make sure. I was suggesting the changes in the news.php file I've attached along with the change to the template posted above. Of course, I haven't tested it at all, so try it on your test site first. If you get an error, post the exact message.

Nothing at all :/
Would the changes have to be done to the module file? After all it's the module I use for the links.

Lynne 03-31-2009 02:40 AM

I am not familiar with modules at all. But, you would have to add the field to the rwc_newsarchive_bit template at least.

Oh, whoops! Change this (in there twice) "if ($latestthread['prefixid']) " to this "if ($thread['prefixid']) ".

MarkFoster 03-31-2009 02:46 AM

Quote:

Originally Posted by Lynne (Post 1780795)
I am not familiar with modules at all. But, you would have to add the field to the rwc_newsarchive_bit template at least.

Oh, whoops! Change this (in there twice) "if ($latestthread['prefixid']) " to this "if ($thread['prefixid']) ".

Now I'm even more confused, what should I do cause I don't fidn that code.

Lynne 03-31-2009 02:52 AM

They are lines in the news.php file. I forgot to change $latestthread to $thread.

MarkFoster 03-31-2009 02:57 AM

Quote:

Originally Posted by Lynne (Post 1780802)
They are lines in the news.php file. I forgot to change $latestthread to $thread.

Okay I edited the PHP, re-uploaded and reinstalled the mod, still nothing... :(

Lynne 03-31-2009 03:00 AM

Reinstalled it? All you should do it reupload the file. If you reinstalled the xml file, then you probably wrote over the template changes you did.

What is in your "rwc_newsarchive_bit" template in the style you are using? And did you make the edit in two places in the news.php file? And what is in your "rwc_latestnews_bit" template? Both of those need the thread prefix added.

If that isn't it, I don't know what else to suggest.

MarkFoster 03-31-2009 03:05 AM

Quote:

Originally Posted by Lynne (Post 1780805)
Reinstalled it? All you should do it reupload the file. If you reinstalled the xml file, then you probably wrote over the template changes you did.

What is in your "rwc_newsarchive_bit" template in the style you are using? And did you make the edit in two places in the news.php file? And what is in your "rwc_latestnews_bit" template? Both of those need the thread prefix added.

If that isn't it, I don't know what else to suggest.

I did the changes in two places yes.

This is my template:
Code:

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
                <td class="thead"><font size="4" face="Verdana">$dateposted - Posted by $thread[postusername]</font></td>
        </tr>
        <tr>
                <td class="alt1"><div class="navbar_notice">                        <!-- icon and title -->
                        <div class="smallfont">
                                <if condition="$show['threadicon']"><img class="inlineimg" src="$thread[threadiconpath]" alt="$thread[threadicontitle]" border="0" /></if>
                                <strong>$thread[title]</strong>
                        </div>
                        <hr size="1" style="color:#000000; background-color:#000000" />
                        <!-- / icon and title -->


                <!-- message -->
                <div id="post_message_$thread[threadid]">$message</div>
                <!-- / message --></div></td>
        </tr>
        </table>
        <br />
</tr>
</table>


Lynne 03-31-2009 03:07 AM

I don't know which template that is (you didn't say), but it doesn't have the thread prefix in it so it's not going to show one.

MarkFoster 03-31-2009 03:10 AM

Quote:

Originally Posted by Lynne (Post 1780809)
I don't know which template that is (you didn't say), but it doesn't have the thread prefix in it so it's not going to show one.

It's the "rwc_newsarchive_bit", what code should I add in them then? ... And where?

Lynne 03-31-2009 03:16 AM

Add either $thread[prefix_plain_html] or $thread[prefix_rich] where you want it to show before the thread title. If you want it to be bolded like the title, put it inside the <strong> tag with the title. If not, put it right before the <strong> tag.

MarkFoster 03-31-2009 03:25 AM

Quote:

Originally Posted by Lynne (Post 1780812)
Add either $thread[prefix_plain_html] or $thread[prefix_rich] where you want it to show before the thread title. If you want it to be bolded like the title, put it inside the <strong> tag with the title. If not, put it right before the <strong> tag.

It works on every single template but not in the links template :/
Is there any way I can work my way behind this?

Or maybe I was just dumb (again) and need professional help, could you add it in the code right before the thread name?
Code:

<a href="$vboptions[bburl]/news.php?id=$thread[threadid]" title="$thread[title]"><strong>$thread[title]</strong></a><br />
$dateposted<br />
Posted by <strong><a href="$vboptions[bburl]/member.php?u=$thread[postuserid]">$thread[postusername]</a></strong><br />
<font size="2" face="Times" color="#383838">
        $message
</font>
<br /><br />


Lynne 03-31-2009 03:31 AM

We already did it for that template here - https://vborg.vbsupport.ru/showpost....62&postcount=8

MarkFoster 03-31-2009 03:42 AM

Quote:

Originally Posted by Lynne (Post 1780820)
We already did it for that template here - https://vborg.vbsupport.ru/showpost....62&postcount=8

Then apprently it wont work :/

Lynne 03-31-2009 06:01 PM

But did you reapply the changes after you reimported the xml file and wrote over everything?

MarkFoster 04-01-2009 01:44 AM

Quote:

Originally Posted by Lynne (Post 1781240)
But did you reapply the changes after you reimported the xml file and wrote over everything?

Yes, and it shows on every page but not the module.


All times are GMT. The time now is 03:50 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02038 seconds
  • Memory Usage 1,841KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_code_printable
  • (2)bbcode_html_printable
  • (4)bbcode_php_printable
  • (14)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (31)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete