X   Сообщение сайта
(Сообщение закроется через 3 секунды)



 

Здравствуйте, гость (

| Вход | Регистрация )

2 страниц V   1 2 >
Открыть тему
Тема закрыта
> Помагите интегрировать ПХП код в Джаву
Umar Abd Al Nur
Umar Abd Al Nur
Topic Starter сообщение 24.2.2011, 18:15; Ответить: Umar Abd Al Nur
Сообщение #1


Скрипт: Скролинг заголовков которые движутся снизу, вверх, и останавливаются когда подносишь мышку.
[JS]
<script type="text/javascript">

var marqueewidth="100%" //Specify the marquee's width (in pixels) (keep in mind any cell padding and images you may have in your themes).
var marqueeheight="150px" //Specify the marquee's height
var scrollinterval=50 // Specify the refresh rate. This affects speed too. Larger is slower.
var pauseit=1 //Pause marquee onMousever of text area (0=no. 1=yes)?

var marqueecontent='Видео сервер подвергся DDOS атакам, незнаю кому это было нужно...';
var direction='up';

if (direction=='up') {
// Scroll upwards start
var marqueespeed=1 // Specify speed (larger is faster 1-10) This is the amount of pixel movement per refresh. 1 is best for smoothness.
marqueespeed=(document.all)? marqueespeed : Math.max(1, marqueespeed-1) //slow speed down by 1 for NS
var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var iedom=document.all||document.getElementById
var actualheight=''
var cross_marquee, ns_marquee

function populate(){
if (iedom){
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
cross_marquee.innerHTML=marqueecontent
actualheight=cross_marquee.offsetHeight
}
else if (document.layers){
ns_marquee=document.ns_marquee.document.ns_marquee2
ns_marquee.top=parseInt(marqueeheight)+8
ns_marquee.document.write(marqueecontent)
ns_marquee.document.close()
actualheight=ns_marquee.document.height
}
lefttime=setInterval("scrollmarquee()",scrollinterval)
}
window.onload=populate

function scrollmarquee(){
if (iedom){
if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8)) {
cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"
}
else {
cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
}
}
else if (document.layers){
if (ns_marquee.top>(actualheight*(-1)+8)) {
ns_marquee.top-=copyspeed
}
else {
ns_marquee.top=parseInt(marqueeheight)+8
}
}
}
function scrolldown(){
copyspeed=marqueespeed-3;

}
function scrolldoubleup(){
copyspeed=marqueespeed+3;

}
var txt='';
if (iedom||document.layers){
with (document){
if (iedom){
txt+='<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'
txt+='<div id="iemarquee" style="position:absolute;left:0px;top:0px;width:100%;">'
txt+='</div></div>'
}
else if (document.layers){
txt+='<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee">'
txt+='<layer name="ns_marquee2" width='+marqueewidth+' height='+marqueeheight+' left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'
txt+='</ilayer>'
}
}
}
}
// Scroll upwards end


// Scroll downwards start
else {
var marqueespeed=-1 // Specify speed (larger is faster 1-10) This is the amount of pixel movement per refresh. 1 is best for smoothness.
marqueespeed=(document.all)? marqueespeed : -1
var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var iedom=document.all||document.getElementById
var actualheight=''
var cross_marquee, ns_marquee

function populate(){
if (iedom){
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
cross_marquee.innerHTML=marqueecontent
actualheight=cross_marquee.offsetHeight
}
else if (document.layers){
ns_marquee=document.ns_marquee.document.ns_marquee2
ns_marquee.top=parseInt(marqueeheight)+8
ns_marquee.document.write(marqueecontent)
ns_marquee.document.close()
actualheight=ns_marquee.document.height
}
lefttime=setInterval("scrollmarquee()",scrollinterval)
}
window.onload=populate

function scrollmarquee(){
if (iedom){
if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8)) {
cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"
}
else {
cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
}
}
else if (document.layers){
if (ns_marquee.top>(actualheight*(-1)+8)) {
ns_marquee.top-=copyspeed
}
else {
ns_marquee.top=parseInt(marqueeheight)+8
}
}
}
function scrollup(){
copyspeed=marqueespeed+3;

}
function scrolldoubledown(){
copyspeed=marqueespeed-3;

}
var txt='';
if (iedom||document.layers){
with (document){
if (iedom){
txt+='<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'
txt+='<div id="iemarquee" style="position:absolute;left:0px;top:0px;width:100%;">'
txt+='</div></div>'
}
else if (document.layers){
txt+='<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee">'
txt+='<layer name="ns_marquee2" width='+marqueewidth+' height='+marqueeheight+' left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'
txt+='</ilayer>'
}
}
}
}
// Scroll downwards end


//-->
</script>

[/JS]
А это ХТМЛ:
<script type="text/javascript">document.write(txt);</script>

я хочу в текст интегрировать ПХП код. Допишите код или если у вас есть готовый вариант, то дайте его мне.
Заранее благодарю.
0
Вернуться в начало страницы
 
Ответить с цитированием данного сообщения
zidan
zidan
сообщение 24.2.2011, 19:57; Ответить: zidan
Сообщение #2


Ты сам понял, что спрашиваешь? PHP-код выполняется на сервере, JavaScript - на клиенте. О какой интеграции какого PHP-кода (самого кода даже нет) может идти речь?

P.S. Опиши лучше задачу полностью.
Вернуться в начало страницы
 
Ответить с цитированием данного сообщения
Umar Abd Al Nur
Umar Abd Al Nur
Topic Starter сообщение 25.2.2011, 10:34; Ответить: Umar Abd Al Nur
Сообщение #3


Мне нужно чтобы была плавающая колонка новостей, и когда подносишь, мышку чтобы колонка останавливалась. Но новости мне надо выбирать из базы данных а не из файла. Я нашел скрипт который я выставил выше

но туда прописываю ПХП код, не работает.
Вот как работает
[JS]var marqueecontent='Видео сервер подвергся DDOS атакам, незнаю кому это было нужно...';[/JS]
А вот так не работает ((
[JS]var marqueecontent='<?PHP include "news.tpl";?>';[/JS]
Вот пример: www.princeigor.net колонка "новое на форуме".
Вернуться в начало страницы
 
Ответить с цитированием данного сообщения
Apay
Apay
сообщение 25.2.2011, 11:14; Ответить: Apay
Сообщение #4


обычно такое делается через ajax

а то что не работает - наверное у вас в тексте news.tpl есть кавычки или подобное, приведите текст файла news.tpl и тогда можно будет сказать почему не работает.
Вернуться в начало страницы
 
Ответить с цитированием данного сообщения
Umar Abd Al Nur
Umar Abd Al Nur
Topic Starter сообщение 25.2.2011, 13:06; Ответить: Umar Abd Al Nur
Сообщение #5


Дело в том, что отдельно этот скрипт работает. Я в примере написал сам ПХП код выглядет вот так:
var marqueecontent=' <?php
$template = "youtube";
$number = "100";
$category = "6";
include("/home/moya_papka_bez_dirok/public_html/module_news/show_news.php");
?> ';

файл show_news.php очень длиный чтоб выкладывать и там нету ошибок уверяю. Нет никак не работает ((
Вернуться в начало страницы
 
Ответить с цитированием данного сообщения
Apay
Apay
сообщение 25.2.2011, 13:09; Ответить: Apay
Сообщение #6


(Umar Abd Al Nur @ 25.2.2011, 15:06) *
и там нету ошибок уверяю
если не работает, значит есть.
Вернуться в начало страницы
 
Ответить с цитированием данного сообщения
Umar Abd Al Nur
Umar Abd Al Nur
Topic Starter сообщение 25.2.2011, 20:20; Ответить: Umar Abd Al Nur
Сообщение #7


Вы правы,
<? print "XCCXC"; ?>
работает , просто в этом файле очень много всего, за всем не устаяться что не работает (( а нельзя никак джаву поменять чтобы в тегах поставить ПХП??
типа вместо этого :
<script type="text/javascript">document.write(txt);</script>

написать
<script type="text/javascript" переменная="document.write(txt)" >
<?php $template = "youtube";
$number = "100";
$category = "6";
include("/home/moya_papka_bez_dirok/public_html/module_news/show_news.php");?>
</script>
Вернуться в начало страницы
 
Ответить с цитированием данного сообщения
Apay
Apay
сообщение 25.2.2011, 20:29; Ответить: Apay
Сообщение #8


можно попробовать обойти
[JS]var marqueecontent="<?php
$template = 'youtube';
$number = '100';
$category = '6';
ob_start();
include("/home/moya_papka_bez_dirok/public_html/module_news/show_news.php");
echo str_replace( '"', '\\"', ob_get_clean() );
?>";
[/JS]
Вернуться в начало страницы
 
Ответить с цитированием данного сообщения
Umar Abd Al Nur
Umar Abd Al Nur
Topic Starter сообщение 25.2.2011, 21:02; Ответить: Umar Abd Al Nur
Сообщение #9


Нет видать не судьба не идет спасибо за помощь . Если что то вдруг вспомните напишите мне если вас не затруднит.
Вернуться в начало страницы
 
Ответить с цитированием данного сообщения
Umar Abd Al Nur
Umar Abd Al Nur
Topic Starter сообщение 26.2.2011, 20:14; Ответить: Umar Abd Al Nur
Сообщение #10


Я тут заметил, что Джава почему то враждует, с инклудом, а нет ли на джаве чего нибудь заменяющий include в пхп?
Вернуться в начало страницы
 
Ответить с цитированием данного сообщения
2 страниц V   1 2 >
Открыть тему
Тема закрыта
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0


Свернуть

> Похожие темы

  Тема Ответов Автор Просмотров Последний ответ
Открытая тема (нет новых ответов) Интегрировать git для сайта
0 Infe 908 26.5.2022, 22:57
автор: Infe
Открытая тема (нет новых ответов) Почистить код на сайте
1 Timka 1108 2.1.2021, 1:13
автор: 0pium
Открытая тема (нет новых ответов) Тема имеет прикрепленные файлыВы мне код, я вам как - делать не надо.
0 fedornabilkin 959 18.9.2020, 18:59
автор: fedornabilkin
Открытая тема (нет новых ответов) Требуется пхп программист на мелкие, периодические, задачи
Работаю только с пост.оплатой.
5 GigArt 1846 29.7.2020, 15:42
автор: GigArt
Открытая тема (нет новых ответов) Тема имеет прикрепленные файлыAdobe muse: Не могу разместить нужный мне код сразу после Body
0 Evg82 3833 20.6.2020, 10:24
автор: Evg82


 



RSS Текстовая версия Сейчас: 23.4.2024, 15:22
Дизайн