Jump to content
  • 0
Ryoma27

Built-in News Page from Fluxcp to my Thor Patcher

Question

4 answers to this question

Recommended Posts

  • 0

In Thor's config.ini file you can set the URL to the page that you want to display in the patcher's box, for example a page called news:

[NoticeBox:Box0]
Width=347
Height=250
Left=21
Top=217
URL='http://www.YOURRO.net/example/news.php'

Are you using the pages/news plugin for your Flux CP? If so, I assume using that URL will probably show the full page, not just the part with the news. In that case one solution could be to:
1. create a new page in a folder of your choice on your server,
2. there, include just the news part of your regular news page with an iframe, or jQuery load the div of your news,
3. and use the URL of your new page in the config.ini instead.

I'm not using the news plugin though, so I don't know if there isn't better way.

Edited by AAlice
Link to comment
Share on other sites

  • 0
20 hours ago, AAlice said:

In Thor's config.ini file you can set the URL to the page that you want to display in the patcher's box, for example a page called news:

[NoticeBox:Box0]
Width=347
Height=250
Left=21
Top=217
URL='http://www.YOURRO.net/example/news.php'

Are you using the pages/news plugin for your Flux CP? If so, I assume using that URL will probably show the full page, not just the part with the news. In that case one solution could be to:
1. create a new page in a folder of your choice on your server,
2. there, include just the news part of your regular news page with an iframe, or jQuery load the div of your news,
3. and use the URL of your new page in the config.ini instead.

I'm not using the news plugin though, so I don't know if there isn't better way.

let say i have URL='http://www.YOURRO.net/?module=news even if i create new page in news, this is always the link given, and yes you are correct the thor patcher shows a full page, can you give me tutorial or example? thanks

Link to comment
Share on other sites

  • 0

I don't think you can use your http://www.YOURRO.net/?module=news link, because it will always show all of your page. You need to create a separate page.
I just tried it with the jQuery approach on my test server and it seems to work. Just a disclaimer ahead, I am not a web developer.

Here's what I did:

1. Create a folder in your folder structure. I created it in the root directory of my FluxCP and named it patchernews

2. Create a page in your new folder. I named it news.html
3. Add these lines of code to your new page:

<html>

<link rel="stylesheet" href="style.css" type="text/css">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript">
	jQuery(document).ready(function(){
		jQuery("#newsbox").load("http://www.YOURRO.net/ #newscontent");
	});
</script>

<div id="newsbox" style="width: 600px"></div>
    
</html>

What we do here is place a div with the ID "newsbox" on our new page. Set width: 600px to the width of your notice box in the Thor patcher.
We then load the content of your news from the URL "http://www.YOURRO.net #newscontent". Set the URL to wherever your news are displayed on your site, but keep #newscontent.
Of course, this only works if you have a div on this page with the ID newscontent

4. So we will wrap a div with the ID newscontent around your news table. Go to the page where your news are displayed and place <div id="newscontent"> at the beginning and </div> at the end.

5.  Go back to news.html and link to the stylesheet you wanna use. Replace href="style.css" with e.g. "../themes/default/css/flux.css" if you are using the default theme of FluxCP.
You can also create a new style.css file in this folder and style the page yourself. This way you have more control over how exactly it should look in that small notice box within the patcher.

6. Change the URL for the notice box in Thor's config.ini to 'http://www.YOURRO.net/patchernews/news.html'


Let me know if it works.

Edited by AAlice
  • Love 1
Link to comment
Share on other sites

  • 0
On 11/3/2020 at 2:19 PM, AAlice said:

I don't think you can use your http://www.YOURRO.net/?module=news link, because it will always show all of your page. You need to create a separate page.
I just tried it with the jQuery approach on my test server and it seems to work. Just a disclaimer ahead, I am not a web developer.

Here's what I did:

1. Create a folder in your folder structure. I created it in the root directory of my FluxCP and named it patchernews

2. Create a page in your new folder. I named it news.html
3. Add these lines of code to your new page:

<html>

<link rel="stylesheet" href="style.css" type="text/css">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript">
	jQuery(document).ready(function(){
		jQuery("#newsbox").load("http://www.YOURRO.net/ #newscontent");
	});
</script>

<div id="newsbox" style="width: 600px"></div>
    
</html>

What we do here is place a div with the ID "newsbox" on our new page. Set width: 600px to the width of your notice box in the Thor patcher.
We then load the content of your news from the URL "http://www.YOURRO.net #newscontent". Set the URL to wherever your news are displayed on your site, but keep #newscontent.
Of course, this only works if you have a div on this page with the ID newscontent

4. So we will wrap a div with the ID newscontent around your news table. Go to the page where your news are displayed and place <div id="newscontent"> at the beginning and </div> at the end.

5.  Go back to news.html and link to the stylesheet you wanna use. Replace href="style.css" with e.g. "../themes/default/css/flux.css" if you are using the default theme of FluxCP.
You can also create a new style.css file in this folder and style the page yourself. This way you have more control over how exactly it should look in that small notice box within the patcher.

6. Change the URL for the notice box in Thor's config.ini to 'http://www.YOURRO.net/patchernews/news.html'


Let me know if it works.

A very good effort! However, Thor's built-in web functionality is based on an old version of Internet Explorer which throws a hissy-fit when javascript is used.

@Ryoma27 If you want to stick with the built-in news feature for FluxCP, I suggest using PHP & SQL queries to extract and display the data. Or post on the FluxCP Github Issues page and request for an RSS feature 😛 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.