vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Javascript and phpinclude Template? (https://vborg.vbsupport.ru/showthread.php?t=69183)

colicab-d 09-07-2004 01:04 PM

Javascript and phpinclude Template?
 
Hi all Im working on a small customhack for my site and so far have the follwing code so that a user hits an optimize link with the url "?styleid=$userstyle"

Anyways ive been at this all day sadly with no ftp access and am now trying to get my variable $mystyle back out in the navbar template so I can apply it works with the above stated style link

Ive added this to my php_include_start template

Code:

<script language="Javascript">

if ((screen.width>=1024) && (screen.height>=768))
{
<?
 $userstyle ="22";
?>
}
else
{
<?
 $userstyle ="21";
?>
}

</script>

Im getting nothing and the link shows as "?styleid= " anyhelp would be great as im quite new to using js in vbull

Dean C 09-07-2004 02:33 PM

Questions about modifying vBulletin's default behaviour and asking about modifications in general, should be posted in General vBulletin Questions. Please read the forum descriptions more carefully in future. I've moved your thread there for you :)

Thanks,
- Dean

Tekton 09-07-2004 06:41 PM

Do you need <?'s in there if it's already set for php?

Hellspire 09-07-2004 08:39 PM

yes you do, else the variable $userstyle would be replaced in the code being included to whatever vbulletin set it prior to, else it sets empty()

Natch 09-08-2004 01:00 AM

For a start, we'd need to see the complete phpinclude tempalte as this may or may not be in contect of other scripting ...

Also, you should ALWAYS use
Code:

<script type="text/javascript" ... >
 ...
</script>

not language="Javascript" as the script tag is not valid without the type and is also not valid with the language ...

This alone may be causing your error (but I doubt it)...

Tekton 09-08-2004 02:43 AM

Quote:

Originally Posted by Natch
For a start, we'd need to see the complete phpinclude tempalte as this may or may not be in contect of other scripting ...

Also, you should ALWAYS use
Code:

<script type="text/javascript" ... >
 ...
</script>

not language="Javascript" as the script tag is not valid without the type and is also not valid with the language ...

This alone may be causing your error (but I doubt it)...

language has worked fine on vB boards for me... *shrugs*

Natch 09-08-2004 12:19 PM

It works, but it's not valid.

In this instance, some browsers will (if rendering in Standards Compatible mode) not render invalid scripts...

rake 09-08-2004 03:19 PM

if it's called phpinclude shouldn't be just php? i'll look into it later.

CarCdr 09-08-2004 03:33 PM

phpinclude_start just gets eval'd and the resulting output is sent to the page being built when the output is assembled.

Colicab, you have a javascript function there that is attempting to output php to be eval'd. That can not work. The javascript is not going to even see the opening and closing PHP tags. As far as the javascript is concerned, the if/else contains no code to be executed.

You talk about a variable named '$mystyle' and a URL param named 'styleid'. Could you explain further what you are trying to do in your template/PHP-side?

Zachery 09-08-2004 03:46 PM

The phpinclude template is for PHP generaly

you cannot use <?php ?> because your already having your php parsed and it will just ignore them.


All times are GMT. The time now is 07:55 PM.

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.00988 seconds
  • Memory Usage 1,737KB
  • 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
  • (3)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete