Posts: 185
Threads: 8
Joined: Apr 2012
2016-10-18, 00:04:47
Hello all,
I'm trying to create a simple plugin, something like catalog..
I've tried to change title by doing
PHP Code: global $title; $title = "new title";
but this doesn't work..
another thing is, what is the best way to implement url structure in GS ?
I'm using something like this:
Code: RewriteRule ^catalog/(.+)?\/(.+)?\/(.+)?$ index.php?id=catalog&main=$1&sub=$2&detail=$3 [QSA,L]
RewriteRule ^catalog/(.+)?\/(.+)?$ index.php?id=catalog&main=$1&sub=$2 [QSA,L]
RewriteRule ^catalog/(.+)?$ index.php?id=catalog&main=$1 [QSA,L]
+
PHP Code: if (isset($_GET['id']) && $_GET['id']=="catalog") { if(!empty($_GET['detail'])) { add_filter('content', 'detail_list'); } elseif(!empty($_GET['sub'])) { add_filter('content', 'sub_list'); } elseif(!empty($_GET['main'])) { add_filter('content', 'main_list'); } else add_filter( 'content', 'all_list' ); }
Thanks for any feedback !
Posts: 6,266
Threads: 181
Joined: Sep 2011
I think someone made a route plugin
Posts: 185
Threads: 8
Joined: Apr 2012
I know, but using plugin for a plugin isn't ideal solution. I think you mean Extra Router.
What about the title? is there a way how to replace the title ? Or am I triggering wrong hook for it ?
Posts: 6,266
Threads: 181
Joined: Sep 2011
Ohh i see
Umm title for what a specific page, non existant page?
What hook are you using?
Posts: 185
Threads: 8
Joined: Apr 2012
2016-10-18, 16:24:28
(This post was last modified: 2016-10-18, 16:27:42 by morvy.)
Yes, I need to change title (and <title> tag) in every generated page. Content comes from json files updated by cron every 12 hours (in real, it updates records once in a week maybe), so everything is basically outside of GS, only "catalog" page is there as a placeholder with metadata and for custom template file if needed.
I tried to use index-pretemplate, content-top hooks but nothing changed, content filter works fine for displaying data in page content, but there is no filter for titles in 3.3
Posts: 538
Threads: 12
Joined: May 2013
(2016-10-18, 16:24:28)morvy Wrote: I tried to use index-pretemplate, content-top hooks but nothing changed, content filter works fine for displaying data in page content, but there is no filter for titles in 3.3
I tried to use following and both seems to work well:
Code: add_action('index-pretemplate', '__change_page_data');
function __change_data() {
global $title;
$title = 'My Title';
}
Code: add_filter('data_index', '__change_page_data');
function __change_page_data() {
global $data_index;
$data_index->title = 'My Title';
$data_index->content = 'Here's my content';
return $data_index;
}
Posts: 185
Threads: 8
Joined: Apr 2012
Thanks, something new that I didn't know about (data_index stuff). Both tricks work, but only for return_page_title in <head>, when calling the same function in <body> I see original title (Catalog)
Posts: 538
Threads: 12
Joined: May 2013
2016-10-18, 18:25:48
(This post was last modified: 2016-10-18, 18:26:38 by Bigin.)
I can't imagine that, unless you use cached content
Posts: 185
Threads: 8
Joined: Apr 2012
Switched to default template and worked fine, so I did a research of my custom functions and found out that breadcrumbs are causing this issue it was using $title so it replaced it there.
problems fixed, thank you guys again for your help!
Posts: 6,266
Threads: 181
Joined: Sep 2011
Why not have your cron job just update the xml pages files titles?
Posts: 185
Threads: 8
Joined: Apr 2012
Shawn, it's nearly 700 entries that need to remain in json because it's used elsewhere too .. so having GS with 700 pages in menu structure would be overkill
Posts: 6,266
Threads: 181
Joined: Sep 2011
I see.
I would use data_index filter for all of this, since globals are set from data_index and other plugins might be using either.
one hook and you just inject your entire phantom page.
Posts: 6,266
Threads: 181
Joined: Sep 2011
The front end router plugin is what I was referring to, but it was buggy.
I have my own fork i was fixing up.
https://github.com/tablatronix/gs-front-..._dataindex
https://github.com/lokothodida/gs-front-router/issues/5
Posts: 185
Threads: 8
Joined: Apr 2012
the router thing looks too difficult for my scenario, so those 3 lines in htaccess seem fine for now.
$data_index is pretty cool I'm using it also for other fields now, so I can reuse different template and join local and remote entries
Posts: 1
Threads: 0
Joined: Oct 2019
2019-10-01, 16:56:34
(This post was last modified: 2019-10-01, 16:58:02 by trantulong.)
My history is having the url http: // a and I want to switch to https://... [MODERATOR NOTE: SPAM - NON GS SITE - REMOVED], what should I do?
Posts: 515
Threads: 21
Joined: Feb 2019
(2019-10-01, 16:56:34)trantulong Wrote: My history is having the url http: // a and I want to switch to [...], what should I do?
http://get-simple.info/wiki/security:https-ssl
How to setup GetSimple on HTTPS/SSL
As of 3.0, you will be able to install GetSimple with a SSL certificate.
Install as you normally would
Confirm the “Website Base URL” is set with the https protocol.
Go to the backend and open the Admin and set there the website base url
Empty the cache
Be sure that all files within your theme and plugins are using https in the url
Check that all your pictures are linked to https
If something is still not working after moving to https
load all the pages from /data and /data-subdirectories into a good code editor, f.e. notepad++ (not Word!)
do a global search and replace, update the URLs of all objects which refer to http://www.olddomain.tld
to https. After that, upload these updated files to your server
Posts: 1,928
Threads: 88
Joined: Apr 2010
I also recommend adding to the file .htaccess
Code: RewriteCond %{ENV:HTTPS} !on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
|