News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Hard-coding 'return to topic after post'

Started by samborabora, March 16, 2014, 10:01:19 AM

Previous topic - Next topic

samborabora

I've set the "Return to topics after posting by default" on my mobile theme, but it isn't actually bothering to follow this setting. Whereabouts in the templates can I hard-code the function to return to topic after posting a reply?

kat

Did you set that in your profile? Or, did you set it in the theme's admin settings?

samborabora

Admin settings to set it for all themes. The mobile theme strangely doesn't show in the settings page, but I set it on all the themes, and I changed the URL in the browser to match the id of the theme, and it appeared to be set to Return to Topic, but it still doesn't work. I guess it must be a badly programmed theme which is why I want to hard code it in.

kat

If it's the theme, itself, that's being a pain, you might get better help in the theme's support topic.

The best that I can figure, code-wise, is this

echo '
<li>
<input type="hidden" name="default_options[return_to_post]" value="0" />
<label for="return_to_post"><input type="checkbox" name="default_options[return_to_post]" id="return_to_post" value="1"', !empty($context['member']['options']['return_to_post']) ? ' checked="checked"' : '', ' class="input_check" /> ', $txt['return_to_post'], '</label>
</li>


in Profile.template.php. If you change "value="0"" to ""value="1"" and vice-versa, it might do the job. But, I'm not sure, of that, by any stretch of the imagination. So, keep a backup of the file, in case I'm wrong, woncha?

samborabora

Thanks so much for your advice, here is the code for the Profile.template.php page for the iphone theme:

<?php
// Version: 2.0 RC4; Profile

function template_profile_above(){}
function 
template_profile_below(){}

function 
template_summary()
{
global $context$settings$options$scripturl$modSettings$txt;

echo ($context['member']['avatar']['href']) ? '
<style type="text/css">
#avatar{
background: url('
.str_replace(' ','%20'$context['member']['avatar']['href']).') #fff center no-repeat !important;}</style>' '''

<div id="profileheader">

<div id="avatar"></div>

<div id="username"><h3>'
$context['member']['name'] ,'</h3><h4>'$context['member']['group'] ,'</h4></div>

</div>


<ul class="profile">

<li>
<div class="field">
<div class="fieldname">'
$txt['iPosts'] .'</div>
<div class="fieldinfo">'
$context['member']['posts'] .'</div>
</div>
</li>'
,$context['member']['show_email'] == 'yes' || $context['member']['show_email'] == 'yes_permission_override' '

<li>
<div class="field">
<div class="fieldname">'
$txt['iEmail'] .'</div>
<div class="fieldinfo">'
$context['member']['email']. '</div>
</div>
</li>'
:'',(!empty($modSettings['titlesEnable']) && !empty($context['member']['title']))?'

<li>
<div class="field">
<div class="fieldname">'
$txt['iTitle'] .'</div>
<div class="fieldinfo">'
$context['member']['title'] .'</div>
</div>
</li>'
:'',($context['member']['blurb']!='')?'

<li>
<div class="field">
<div class="fieldname">'
$txt['iText'] .'</div>
<div class="fieldinfo">'
$context['member']['blurb']. '</div>
</div>
</li>'
:'', ($modSettings['karmaMode'] == '1') ? '

<li>
<div class="field">
<div class="fieldname">'
$txt['iKarma'] . ' </div>
<div class="fieldinfo">'
.($context['member']['karma']['good'] - $context['member']['karma']['bad']).'</div>
</div>
</li>'
:'', ($modSettings['karmaMode'] == '2') ? '

<li>
<div class="field">
<div class="fieldname">'
$modSettings['karmaLabel']. ' </div>
<div class="fieldinfo">+'
$context['member']['karma']['good']. '/-'$context['member']['karma']['bad']. '</div>
</div>
</li>'
:'', (!isset($context['disabled_fields']['gender']) && !empty($context['member']['gender']['name'])) ? '

<li>
<div class="field">
<div class="fieldname">'
$txt['iGender'] .'</div>
<div class="fieldinfo">'
.$context['member']['gender']['name'].'</div>
</div>
</li>'
:'', ($context['member']['age']>0)? '

<li>
<div class="field">
<div class="fieldname">'
$txt['iAge'] .'</div>
<div class="fieldinfo">'
$context['member']['age'].'</div>
</div>
</li>'
:'',(!isset($context['disabled_fields']['location']) && !empty($context['member']['location']))?'

<li><div class="field">
<div class="fieldname">'
$txt['iLocation'] .'</div>
<div class="fieldinfo">'
.$context['member']['location'].'</div>
</div>
</li>'
:'','

<li>
<div class="field">
<div class="fieldname">'
$txt['iRegistered'] .'</div>
<div class="fieldinfo">'
$context['member']['registered'] ,' </div>
</div>
</li>

<li>
<div class="field">
<div class="fieldname">'
$txt['iLastActive'] .'</div>
<div class="fieldinfo">'
$context['member']['last_login'], '</div>
</div>
</li>'
,($context['can_see_ip'])?'

<li>
<div class="field">
<div class="fieldname">'
$txt['iIP'] .'</div>
<div class="fieldinfo"><a href="#" style="color:#000">'
.$context['member']['ip'].'</a></div>
</div>
</li>'
:'',(empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip']) && $context['can_see_ip']) ? '

<li>
<div class="field">
<div class="fieldname">'
$txt['iHostname'] .'</div>
<div class="fieldinfo">'
$context['member']['hostname']. '</div>
</div>
</li>'
:'','

<li><div class="last field">
<div class="fieldname">'
$txt['iLocalTime'] .'</div>
<div class="fieldinfo">'
$context['member']['local_time'], '</div>
</div>
</li>

</ul>

<div class="profilebuttons">

<button'
, ($context['can_send_pm']) ? '':' disabled="disabled"' ,' onclick="window.location.href=\'index.php?action=pm;sa=send;u='$context['member']['id'] ,'\';">'$txt['iSendPM'] ,'</button>

<button'
, ($context['member']['show_email'] == 'yes' || $context['member']['show_email'] == 'yes_permission_override') ? ' onclick="window.location=\'mailto:'$context['member']['email'] .'\';"':' disabled="disabled"','>'$txt['iSendEmail'] ,'</button></button>


</div>

'
;

}

?>


There doesn't appear to be any of those lines here, which could explain the problem somewhat. Is there somewhere he in which these values could go?

kat

Yuk! With that file, as it is, I'd try a bit of "Trial and error", to see if I can get it to work.

samborabora

Been playing around but, not having alot of luck. Is this theme drastically different from Curve, since I can't quite see where the return_to_post function could really go on this. I'd really appreciate any ideas as to why it isn't returning to the post at all, even after it has been setup in the Layout settings.

margarett

You should really get some support in the theme's support topic...

You need to check, in the table "smf_themes", if you find a record like "return_to_post", with your user ID and the theme's ID, value = 1
This is the first step to check if the database setting is there or not.
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

samborabora

Sorry for the late reply! I quite agree, I should ask in the theme's support, but it's so old this mobile theme! smf4iphone is super dead, but it's a really nice, quick theme for the phone, so I fitted it out with better detector and it shows up well, it's just for some reason there aren't any available theme options for it, the smf4iphone theme literally doesn't show up in member options, I wasn't aware that you could disable things like this for a theme? Is there anyway of hard wiring these kinds of settings in?

EDIT: It also doesn't have the "Edit this theme's stylesheets." under modify themes, I had no idea you could deactivate such settings?

Hj Ahmad Rasyid Hj Ismail

Interesting... I was about to create my own mobile theme. May be I can look into this too...

Arantor

The best mobile theme for SMF 2.0 is Dragooon's SMF4Mobile available from smf-media.com (paid). It'll take something fairly special to replace that.

2.1 is slowly gaining better mobile-aware theming though.

samborabora

Quote from: ahrasis on August 05, 2014, 12:40:12 PM
Interesting... I was about to create my own mobile theme. May be I can look into this too...
It's a strange old theme, it seemed to be created by one person, then that was taken it was repacked with a detector by fabius, I believe. I've gotten used to it style, and the html is really lite, just divs, spans and a lot of li's, but I think these days it has a few issues that I'm working through and trying to repair. If you're interested in what's going on with it, the download is: http://custom.simplemachines.org/themes/index.php?lemma=2089 but I'm currently using it with http://custom.simplemachines.org/mods/index.php?mod=3349 Mobile Device Detect.

Quote from: ‽ on August 05, 2014, 12:41:35 PM
The best mobile theme for SMF 2.0 is Dragooon's SMF4Mobile available from smf-media.com (paid). It'll take something fairly special to replace that.

2.1 is slowly gaining better mobile-aware theming though.

I hadn't seen that one, it does look amazingly all-singing, all-dancing, I forgot there were paid themes external to this site. I defiantly meant the best mobile theme I'd seen for free  ;)

Hj Ahmad Rasyid Hj Ismail

It's normal for mobile theme to drop many of the smf forum features especially administrative ones.

Dragoon mobile theme seems very good to me too. ;) It will be better if he can make it an android and ios app as well instead of just mobile theme. That would be gorgeous.

Arantor


Hj Ahmad Rasyid Hj Ismail

May be and may be not so expensive. The only think I think lacking is notification for the app implementation. Other than that web view function (for android) can call the forum just fine.

Arantor

No, it is more expensive seeing how it has a base cost even to just get started on the whole app development thing, unless you're talking about something like Tapatalk, but then there's Tapatalk which works on more than just SMF forums.

Hj Ahmad Rasyid Hj Ismail

I have created an android app: http://goo.gl/VnToA

I don't see why this one should be more difficult and should cost more if I am just going to use a simple webview function. I have all the tools and will create one to see how difficult it can be.

I will also share the steps for others to create one similar app later.

Arantor

Firstly, a simple webview does absolutely nothing of any practical use because there's no useful difference between a webview on a predefined webpage and just using the native browser to go to the same webpage.

Secondly, on iOS, it's demonstrably worse for the user experience because UIWebView gets a slower JavaScript engine than Safari does.

If you're going to build a native app, the idea is to actually build something with a phone-scaled UI using phone UI conventions, which a webview won't magically fix for you. Which means you need some kind of API on the server side to provide just the data for your custom built front end, like Tapatalk does.


Hj Ahmad Rasyid Hj Ismail

I prefer to do a simpler thing first. Once it is done, I can try to improve it bit by bit. First, I will do an android app with web view of a forum running mobile theme. Second, I will improve it by having some sort of forum notification. That is enough for me already and I will surely share this later.

Definitely someone like you can do more, if you want it. But that is, if you want it.

Arantor

But that still requires you having a mobile theme in the first place, which is the entire point of what you want to avoid if you have a native app.

Have fun with it. I personally think you're wasting a lot of time for no actual benefit, but have fun with it.

Advertisement: